add stun immunity script (#1015)

several summons use this script to be immune to stuns
This commit is contained in:
Aaron Kimbrell 2023-03-08 07:31:45 -06:00 committed by GitHub
parent 49047a267b
commit ff0336793c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 1 deletions

View File

@ -281,6 +281,7 @@
#include "GemPack.h" #include "GemPack.h"
#include "ShardArmor.h" #include "ShardArmor.h"
#include "TeslaPack.h" #include "TeslaPack.h"
#include "StunImmunity.h"
// Survival scripts // Survival scripts
#include "AgSurvivalStromling.h" #include "AgSurvivalStromling.h"
@ -846,6 +847,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
script = new ShardArmor(); script = new ShardArmor();
else if (scriptName == "scripts\\equipmenttriggers\\coilbackpack.lua") else if (scriptName == "scripts\\equipmenttriggers\\coilbackpack.lua")
script = new TeslaPack(); script = new TeslaPack();
else if (scriptName == "scripts\\EquipmentScripts\\stunImmunity.lua")
script = new StunImmunity();
// FB // FB
else if (scriptName == "scripts\\ai\\NS\\WH\\L_ROCKHYDRANT_BROKEN.lua") else if (scriptName == "scripts\\ai\\NS\\WH\\L_ROCKHYDRANT_BROKEN.lua")

View File

@ -6,4 +6,5 @@ set(DSCRIPTS_SOURCES_EQUIPMENTSCRIPTS
"PersonalFortress.cpp" "PersonalFortress.cpp"
"BuccaneerValiantShip.cpp" "BuccaneerValiantShip.cpp"
"FireFirstSkillonStartup.cpp" "FireFirstSkillonStartup.cpp"
"StunImmunity.cpp"
PARENT_SCOPE) PARENT_SCOPE)

View File

@ -0,0 +1,19 @@
#include "StunImmunity.h"
#include "DestroyableComponent.h"
#include "ControllablePhysicsComponent.h"
void StunImmunity::OnStartup(Entity* self) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent) {
destroyableComponent->SetStatusImmunity(
eStateChangeType::PUSH, false, false, true, true, false, false, false, false, true
);
}
auto* controllablePhysicsComponent = self->GetComponent<ControllablePhysicsComponent>();
if (controllablePhysicsComponent) {
controllablePhysicsComponent->SetStunImmunity(
eStateChangeType::PUSH, self->GetObjectID(), true
);
}
}

View File

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