DarkflameServer/dScripts/ai/FV/FvDragonSmashingGolemQb.cpp
Aaron Kimbrell 6aa90ad5b2
Breakout rest of the enums from dCommonVars and clean it up (#1061)
* Breakout rest of the enums from dcommonvars
so we don't have to deal with merge conflicts
ePlayerFlags is not a scoped enum, yet, due to it's complexity

* address feedback

* make player flag types consistent

* fix typo
2023-05-02 17:39:21 -05:00

32 lines
853 B
C++

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