2021-12-05 17:54:36 +00:00
|
|
|
#include "MonCoreNookDoors.h"
|
|
|
|
#include "dZoneManager.h"
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void MonCoreNookDoors::OnStartup(Entity* self) {
|
|
|
|
SpawnDoor(self);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void MonCoreNookDoors::SpawnDoor(Entity* self) {
|
|
|
|
const auto doorNum = self->GetVarAsString(u"number");
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (doorNum.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
const auto spawners = dZoneManager::Instance()->GetSpawnersByName("MonCoreNookDoor0" + doorNum);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (spawners.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
auto* spawner = spawners[0];
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
spawner->Reset();
|
|
|
|
spawner->Activate();
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void MonCoreNookDoors::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
|
|
|
if (args == "DoorSmashed") {
|
|
|
|
self->AddTimer("RespawnDoor", 30);
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void MonCoreNookDoors::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
if (timerName == "RespawnDoor") {
|
|
|
|
SpawnDoor(self);
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|