DarkflameServer/dScripts/ai/FV/FvDragonSmashingGolemQb.cpp

31 lines
834 B
C++
Raw Normal View History

#include "FvDragonSmashingGolemQb.h"
#include "GameMessages.h"
#include "EntityManager.h"
2022-07-28 13:39:57 +00:00
void FvDragonSmashingGolemQb::OnStartup(Entity* self) {
self->AddTimer("GolemBreakTimer", 10.5f);
}
2022-07-28 13:39:57 +00:00
void FvDragonSmashingGolemQb::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "GolemBreakTimer") {
self->Smash();
}
}
2022-07-28 13:39:57 +00:00
void FvDragonSmashingGolemQb::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state == eRebuildState::REBUILD_COMPLETED) {
GameMessages::SendPlayAnimation(self, u"dragonsmash");
2022-07-28 13:39:57 +00:00
const auto dragonId = self->GetVar<LWOOBJID>(u"Dragon");
2022-07-28 13:39:57 +00:00
auto* dragon = EntityManager::Instance()->GetEntity(dragonId);
2022-07-28 13:39:57 +00:00
if (dragon != nullptr) {
dragon->OnFireEventServerSide(self, "rebuildDone");
}
2022-07-28 13:39:57 +00:00
self->CancelTimer("GolemBreakTimer");
self->AddTimer("GolemBreakTimer", 10.5f);
}
}