DarkflameServer/dScripts/MonCoreNookDoors.cpp

38 lines
832 B
C++
Raw Normal View History

#include "MonCoreNookDoors.h"
#include "dZoneManager.h"
2022-07-28 13:39:57 +00:00
void MonCoreNookDoors::OnStartup(Entity* self) {
SpawnDoor(self);
}
2022-07-28 13:39:57 +00:00
void MonCoreNookDoors::SpawnDoor(Entity* self) {
const auto doorNum = self->GetVarAsString(u"number");
2022-07-28 13:39:57 +00:00
if (doorNum.empty()) {
return;
}
2022-07-28 13:39:57 +00:00
const auto spawners = dZoneManager::Instance()->GetSpawnersByName("MonCoreNookDoor0" + doorNum);
2022-07-28 13:39:57 +00:00
if (spawners.empty()) {
return;
}
2022-07-28 13:39:57 +00:00
auto* spawner = spawners[0];
2022-07-28 13:39:57 +00:00
spawner->Reset();
spawner->Activate();
}
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);
}
}
2022-07-28 13:39:57 +00:00
void MonCoreNookDoors::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "RespawnDoor") {
SpawnDoor(self);
}
}