DarkflameServer/dScripts/ai/GF/GfJailWalls.cpp
David Markowitz 3e3148e910
Move dZoneManager to game namespace (#1143)
* convert zone manager to game namespace

* Destroy logger last
2023-07-17 17:55:33 -05:00

31 lines
911 B
C++

#include "GfJailWalls.h"
#include "dZoneManager.h"
#include "GeneralUtils.h"
#include "eRebuildState.h"
void GfJailWalls::OnRebuildComplete(Entity* self, Entity* target) {
const auto wall = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"Wall"));
for (auto* spawner : Game::zoneManager->GetSpawnersByName("Jail0" + wall)) {
spawner->Deactivate();
}
for (auto* spawner : Game::zoneManager->GetSpawnersByName("JailCaptain0" + wall)) {
spawner->Deactivate();
}
}
void GfJailWalls::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state != eRebuildState::RESETTING) return;
const auto wall = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"Wall"));
for (auto* spawner : Game::zoneManager->GetSpawnersByName("Jail0" + wall)) {
spawner->Activate();
}
for (auto* spawner : Game::zoneManager->GetSpawnersByName("JailCaptain0" + wall)) {
spawner->Activate();
}
}