2021-12-05 17:54:36 +00:00
|
|
|
#include "MonCoreSmashableDoors.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void MonCoreSmashableDoors::OnDie(Entity* self, Entity* killer) {
|
|
|
|
auto myNum = self->GetVarAsString(u"spawner_name");
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
myNum = myNum.substr(myNum.length() - 1, 1);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
|
|
|
auto triggerGroup = "CoreNookTrig0" + myNum;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
// Get the trigger
|
|
|
|
auto triggers = EntityManager::Instance()->GetEntitiesInGroup(triggerGroup);
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (triggers.empty()) {
|
2021-12-05 17:54:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
for (auto trigger : triggers) {
|
2021-12-05 17:54:36 +00:00
|
|
|
trigger->OnFireEventServerSide(self, "DoorSmashed");
|
|
|
|
}
|
|
|
|
}
|