From 31be1fbe4cf90aeb8c55181613a50ad84d10c0b0 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Tue, 13 Jun 2023 19:55:27 -0700 Subject: [PATCH] remove script stuff --- dGame/dGameMessages/GameMessageHandler.cpp | 8 +-- dGame/dGameMessages/GameMessages.cpp | 60 ++++++++----------- .../Map/NT/NtCombatChallengeDummy.cpp | 8 +-- .../NT/NtCombatChallengeExplodingDummy.cpp | 8 +-- 4 files changed, 30 insertions(+), 54 deletions(-) diff --git a/dGame/dGameMessages/GameMessageHandler.cpp b/dGame/dGameMessages/GameMessageHandler.cpp index 32630325..04a013a3 100644 --- a/dGame/dGameMessages/GameMessageHandler.cpp +++ b/dGame/dGameMessages/GameMessageHandler.cpp @@ -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 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); } } diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 4f570acd..dfda8be6 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -949,7 +949,7 @@ void GameMessages::SendResurrect(Entity* entity) { destroyableComponent->SetImagination(imaginationToRestore); } } - }); + }); auto* cont = entity->GetComponent(); @@ -2984,14 +2984,14 @@ void GameMessages::SendSetStunned(LWOOBJID objectId, eStateChangeType stateChang } void GameMessages::SendSetStunImmunity(LWOOBJID target, eStateChangeType state, const SystemAddress& sysAddr, - LWOOBJID originator, - bool bImmuneToStunAttack, - bool bImmuneToStunEquip, - bool bImmuneToStunInteract, - bool bImmuneToStunJump, - bool bImmuneToStunMove, - bool bImmuneToStunTurn, - bool bImmuneToStunUseItem) { + LWOOBJID originator, + bool bImmuneToStunAttack, + bool bImmuneToStunEquip, + bool bImmuneToStunInteract, + bool bImmuneToStunJump, + bool bImmuneToStunMove, + bool bImmuneToStunTurn, + bool bImmuneToStunUseItem) { CBITSTREAM; CMSGHEADER; @@ -3016,15 +3016,15 @@ void GameMessages::SendSetStunImmunity(LWOOBJID target, eStateChangeType state, } void GameMessages::SendSetStatusImmunity(LWOOBJID objectId, eStateChangeType state, const SystemAddress& sysAddr, - bool bImmuneToBasicAttack, - bool bImmuneToDamageOverTime, - bool bImmuneToKnockback, - bool bImmuneToInterrupt, - bool bImmuneToSpeed, - bool bImmuneToImaginationGain, - bool bImmuneToImaginationLoss, - bool bImmuneToQuickbuildInterrupt, - bool bImmuneToPullToPoint) { + bool bImmuneToBasicAttack, + bool bImmuneToDamageOverTime, + bool bImmuneToKnockback, + bool bImmuneToInterrupt, + bool bImmuneToSpeed, + bool bImmuneToImaginationGain, + bool bImmuneToImaginationLoss, + bool bImmuneToQuickbuildInterrupt, + bool bImmuneToPullToPoint) { CBITSTREAM; CMSGHEADER; @@ -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(); @@ -5653,9 +5649,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity* auto* script = entity->GetComponent(); - 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 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 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); } } diff --git a/dScripts/02_server/Map/NT/NtCombatChallengeDummy.cpp b/dScripts/02_server/Map/NT/NtCombatChallengeDummy.cpp index c9cd8f0a..b02e577a 100644 --- a/dScripts/02_server/Map/NT/NtCombatChallengeDummy.cpp +++ b/dScripts/02_server/Map/NT/NtCombatChallengeDummy.cpp @@ -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); } } diff --git a/dScripts/02_server/Map/NT/NtCombatChallengeExplodingDummy.cpp b/dScripts/02_server/Map/NT/NtCombatChallengeExplodingDummy.cpp index 83c24510..7caac3ee 100644 --- a/dScripts/02_server/Map/NT/NtCombatChallengeExplodingDummy.cpp +++ b/dScripts/02_server/Map/NT/NtCombatChallengeExplodingDummy.cpp @@ -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(); if (skillComponent != nullptr) {