DarkflameServer/dScripts/AmBridge.cpp

29 lines
627 B
C++
Raw Normal View History

#include "AmBridge.h"
#include "EntityManager.h"
2022-07-28 13:39:57 +00:00
void AmBridge::OnStartup(Entity* self) {
}
2022-07-28 13:39:57 +00:00
void AmBridge::OnRebuildComplete(Entity* self, Entity* target) {
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console" + GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"bridge")));
2022-07-28 13:39:57 +00:00
if (consoles.empty()) {
return;
}
2022-07-28 13:39:57 +00:00
auto* console = consoles[0];
2022-07-28 13:39:57 +00:00
console->NotifyObject(self, "BridgeBuilt");
2022-07-28 13:39:57 +00:00
self->AddTimer("SmashBridge", 50);
}
2022-07-28 13:39:57 +00:00
void AmBridge::OnTimerDone(Entity* self, std::string timerName) {
if (timerName != "SmashBridge") {
return;
}
2022-07-28 13:39:57 +00:00
self->Smash(self->GetObjectID(), VIOLENT);
}