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(); Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) { if (zoneControl) zoneControl->GetScript()->OnPlayerLoaded(zoneControl, player);
script->OnPlayerLoaded(zoneControl, player);
}
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPT); std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPT);
for (Entity* scriptEntity : scriptedActs) { for (Entity* scriptEntity : scriptedActs) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) { scriptEntity->GetScript()->OnPlayerLoaded(scriptEntity, player);
script->OnPlayerLoaded(scriptEntity, player);
}
} }
} }

View File

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

View File

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

View File

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