From f22bf2466343037ea06a4504961127ed9b584e62 Mon Sep 17 00:00:00 2001 From: Mick Vermeulen Date: Wed, 8 Dec 2021 20:00:00 +0100 Subject: [PATCH] Update BaseEnemyMech script to change the default faction As part of the base enemy mech script its faction should be updated to 4 to make sure it's seen as an enemy by the client. The AgDarklingMech script has been deleted as its functionality was essentially that of BaseEnemyMech and thus no longer necessary. --- dScripts/AgDarklingMech.cpp | 9 --------- dScripts/AgDarklingMech.h | 6 ------ dScripts/AmDarklingMech.cpp | 5 +---- dScripts/BaseEnemyMech.cpp | 8 ++++++++ dScripts/BaseEnemyMech.h | 1 + dScripts/CppScripts.cpp | 3 +-- dScripts/VeMech.cpp | 1 + 7 files changed, 12 insertions(+), 21 deletions(-) delete mode 100644 dScripts/AgDarklingMech.cpp delete mode 100644 dScripts/AgDarklingMech.h diff --git a/dScripts/AgDarklingMech.cpp b/dScripts/AgDarklingMech.cpp deleted file mode 100644 index 335eabe4..00000000 --- a/dScripts/AgDarklingMech.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "AgDarklingMech.h" -#include "DestroyableComponent.h" - -void AgDarklingMech::OnStartup(Entity *self) { - auto* destroyableComponent = self->GetComponent(); - if (destroyableComponent != nullptr) { - destroyableComponent->SetFaction(4); - } -} diff --git a/dScripts/AgDarklingMech.h b/dScripts/AgDarklingMech.h deleted file mode 100644 index 2d92f2f6..00000000 --- a/dScripts/AgDarklingMech.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once -#include "BaseEnemyMech.h" - -class AgDarklingMech : public BaseEnemyMech { - void OnStartup(Entity* self) override; -}; diff --git a/dScripts/AmDarklingMech.cpp b/dScripts/AmDarklingMech.cpp index dd95883b..59eb6b45 100644 --- a/dScripts/AmDarklingMech.cpp +++ b/dScripts/AmDarklingMech.cpp @@ -3,9 +3,6 @@ void AmDarklingMech::OnStartup(Entity* self) { - auto* destroyableComponent = self->GetComponent(); - - destroyableComponent->SetFaction(4); - + BaseEnemyMech::OnStartup(self); qbTurretLOT = 13171; } diff --git a/dScripts/BaseEnemyMech.cpp b/dScripts/BaseEnemyMech.cpp index 37678857..eb95095a 100644 --- a/dScripts/BaseEnemyMech.cpp +++ b/dScripts/BaseEnemyMech.cpp @@ -7,6 +7,14 @@ #include "EntityManager.h" #include "dpWorld.h" #include "GeneralUtils.h" +#include "DestroyableComponent.h" + +void BaseEnemyMech::OnStartup(Entity* self) { + auto* destroyableComponent = self->GetComponent(); + if (destroyableComponent != nullptr) { + destroyableComponent->SetFaction(4); + } +} void BaseEnemyMech::OnDie(Entity* self, Entity* killer) { ControllablePhysicsComponent* controlPhys = static_cast(self->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS)); diff --git a/dScripts/BaseEnemyMech.h b/dScripts/BaseEnemyMech.h index f9f0b025..a8955061 100644 --- a/dScripts/BaseEnemyMech.h +++ b/dScripts/BaseEnemyMech.h @@ -4,6 +4,7 @@ class BaseEnemyMech : public CppScripts::Script { public: + void OnStartup(Entity* self) override; void OnDie(Entity* self, Entity* killer) override; protected: LOT qbTurretLOT = 6254; diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 99702805..ed59c5ba 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -51,7 +51,6 @@ #include "NpcCowboyServer.h" #include "ZoneAgMedProperty.h" #include "AgStromlingProperty.h" -#include "AgDarklingMech.h" #include "AgDarkSpiderling.h" #include "PropertyFXDamage.h" #include "AgPropguards.h" @@ -377,7 +376,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr else if (scriptName == "scripts\\ai\\AG\\L_AG_STROMBIE_PROPERTY.lua") script = new AgStromlingProperty(); else if (scriptName == "scripts\\ai\\AG\\L_AG_DARKLING_MECH.lua") - script = new AgDarklingMech(); + script = new BaseEnemyMech(); else if (scriptName == "scripts\\ai\\AG\\L_AG_DARK_SPIDERLING.lua") script = new AgDarkSpiderling(); else if (scriptName == "scripts\\ai\\PROPERTY\\L_PROP_GUARDS.lua") diff --git a/dScripts/VeMech.cpp b/dScripts/VeMech.cpp index e26b34b0..87f2e88f 100644 --- a/dScripts/VeMech.cpp +++ b/dScripts/VeMech.cpp @@ -1,5 +1,6 @@ #include "VeMech.h" void VeMech::OnStartup(Entity *self) { + BaseEnemyMech::OnStartup(self); qbTurretLOT = 8432; }