Merge pull request #134 from DarkflameUniverse/fix-sentry-faction

Update BaseEnemyMech script to change the default faction
This commit is contained in:
Mick 2021-12-09 18:17:55 +01:00 committed by GitHub
commit 51600a5329
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 21 deletions

View File

@ -1,9 +0,0 @@
#include "AgDarklingMech.h"
#include "DestroyableComponent.h"
void AgDarklingMech::OnStartup(Entity *self) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
destroyableComponent->SetFaction(4);
}
}

View File

@ -1,6 +0,0 @@
#pragma once
#include "BaseEnemyMech.h"
class AgDarklingMech : public BaseEnemyMech {
void OnStartup(Entity* self) override;
};

View File

@ -3,9 +3,6 @@
void AmDarklingMech::OnStartup(Entity* self) void AmDarklingMech::OnStartup(Entity* self)
{ {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>(); BaseEnemyMech::OnStartup(self);
destroyableComponent->SetFaction(4);
qbTurretLOT = 13171; qbTurretLOT = 13171;
} }

View File

@ -7,6 +7,14 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "dpWorld.h" #include "dpWorld.h"
#include "GeneralUtils.h" #include "GeneralUtils.h"
#include "DestroyableComponent.h"
void BaseEnemyMech::OnStartup(Entity* self) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
destroyableComponent->SetFaction(4);
}
}
void BaseEnemyMech::OnDie(Entity* self, Entity* killer) { void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS)); ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS));

View File

@ -4,6 +4,7 @@
class BaseEnemyMech : public CppScripts::Script class BaseEnemyMech : public CppScripts::Script
{ {
public: public:
void OnStartup(Entity* self) override;
void OnDie(Entity* self, Entity* killer) override; void OnDie(Entity* self, Entity* killer) override;
protected: protected:
LOT qbTurretLOT = 6254; LOT qbTurretLOT = 6254;

View File

@ -51,7 +51,6 @@
#include "NpcCowboyServer.h" #include "NpcCowboyServer.h"
#include "ZoneAgMedProperty.h" #include "ZoneAgMedProperty.h"
#include "AgStromlingProperty.h" #include "AgStromlingProperty.h"
#include "AgDarklingMech.h"
#include "AgDarkSpiderling.h" #include "AgDarkSpiderling.h"
#include "PropertyFXDamage.h" #include "PropertyFXDamage.h"
#include "AgPropguards.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") else if (scriptName == "scripts\\ai\\AG\\L_AG_STROMBIE_PROPERTY.lua")
script = new AgStromlingProperty(); script = new AgStromlingProperty();
else if (scriptName == "scripts\\ai\\AG\\L_AG_DARKLING_MECH.lua") 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") else if (scriptName == "scripts\\ai\\AG\\L_AG_DARK_SPIDERLING.lua")
script = new AgDarkSpiderling(); script = new AgDarkSpiderling();
else if (scriptName == "scripts\\ai\\PROPERTY\\L_PROP_GUARDS.lua") else if (scriptName == "scripts\\ai\\PROPERTY\\L_PROP_GUARDS.lua")

View File

@ -1,5 +1,6 @@
#include "VeMech.h" #include "VeMech.h"
void VeMech::OnStartup(Entity *self) { void VeMech::OnStartup(Entity *self) {
BaseEnemyMech::OnStartup(self);
qbTurretLOT = 8432; qbTurretLOT = 8432;
} }