remove script stuff

This commit is contained in:
David Markowitz 2023-06-13 19:55:27 -07:00
parent d8e2e92428
commit 31be1fbe4c
4 changed files with 30 additions and 54 deletions

View File

@ -133,16 +133,12 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
}
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
script->OnPlayerLoaded(zoneControl, player);
}
if (zoneControl) zoneControl->GetScript()->OnPlayerLoaded(zoneControl, player);
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPT);
for (Entity* scriptEntity : scriptedActs) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) {
script->OnPlayerLoaded(scriptEntity, player);
}
scriptEntity->GetScript()->OnPlayerLoaded(scriptEntity, player);
}
}

View File

@ -5206,9 +5206,7 @@ void GameMessages::HandleRespondToMission(RakNet::BitStream* inStream, Entity* e
return;
}
for (CppScripts::Script* script : CppScripts::GetEntityScripts(offerer)) {
script->OnRespondToMission(offerer, missionID, EntityManager::Instance()->GetEntity(playerID), reward);
}
offerer->GetScript()->OnRespondToMission(offerer, missionID, EntityManager::Instance()->GetEntity(playerID), reward);
}
void GameMessages::HandleMissionDialogOK(RakNet::BitStream* inStream, Entity* entity) {
@ -5224,9 +5222,7 @@ void GameMessages::HandleMissionDialogOK(RakNet::BitStream* inStream, Entity* en
inStream->Read(responder);
player = EntityManager::Instance()->GetEntity(responder);
for (CppScripts::Script* script : CppScripts::GetEntityScripts(entity)) {
script->OnMissionDialogueOK(entity, player, missionID, iMissionState);
}
entity->GetScript()->OnMissionDialogueOK(entity, player, missionID, iMissionState);
// Get the player's mission component
auto* missionComponent = player->GetComponent<MissionComponent>();
@ -5653,9 +5649,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
auto* script = entity->GetComponent<ScriptComponent>();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(entity)) {
script->OnModularBuildExit(entity, character, count >= 3, modList);
}
entity->GetScript()->OnModularBuildExit(entity, character, count >= 3, modList);
// Move remaining temp models back to models
std::vector<Item*> items;
@ -5829,16 +5823,12 @@ void GameMessages::HandleResurrect(RakNet::BitStream* inStream, Entity* entity)
bool immediate = inStream->ReadBit();
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
script->OnPlayerResurrected(zoneControl, entity);
}
zoneControl->GetScript()->OnPlayerResurrected(zoneControl, entity);
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
for (Entity* scriptEntity : scriptedActs) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) {
script->OnPlayerResurrected(scriptEntity, entity);
}
scriptEntity->GetScript()->OnPlayerResurrected(scriptEntity, entity);
}
}
}
@ -6090,9 +6080,7 @@ void GameMessages::HandlePlayerRailArrivedNotification(RakNet::BitStream* inStre
const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::RAIL_ACTIVATOR);
for (auto* possibleRail : possibleRails) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(possibleRail)) {
script->OnPlayerRailArrived(possibleRail, entity, pathName, waypointNumber);
}
possibleRail->GetScript()->OnPlayerRailArrived(possibleRail, entity, pathName, waypointNumber);
}
}

View File

@ -7,9 +7,7 @@ void NtCombatChallengeDummy::OnDie(Entity* self, Entity* killer) {
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnDie(challengeObject, killer);
}
challengeObject->GetScript()->OnDie(challengeObject, killer);
}
}
@ -19,8 +17,6 @@ void NtCombatChallengeDummy::OnHitOrHealResult(Entity* self, Entity* attacker, i
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnHitOrHealResult(challengeObject, attacker, damage);
}
challengeObject->GetScript()->OnHitOrHealResult(challengeObject, attacker, damage);
}
}

View File

@ -8,9 +8,7 @@ void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnDie(challengeObject, killer);
}
challengeObject->GetScript()->OnDie(challengeObject, killer);
}
}
@ -20,9 +18,7 @@ void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* at
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnHitOrHealResult(challengeObject, attacker, damage);
}
challengeObject->GetScript()->OnHitOrHealResult(challengeObject, attacker, damage);
}
auto* skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent != nullptr) {