DarkflameServer/dScripts/EquipmentScripts/StunImmunity.cpp
Aaron Kimbrell ff0336793c
add stun immunity script (#1015)
several summons use this script to be immune to stuns
2023-03-08 07:31:45 -06:00

20 lines
628 B
C++

#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
);
}
}