DarkflameServer/dScripts/ai/FV/FvDragonSmashingGolemQb.cpp
Aaron Kimbrell 15954413ae
chore: rename rebuild to quickbuild (#1364)
* rename rebuild to quickbuild

* fix includes
2023-12-28 22:24:30 -06:00

34 lines
907 B
C++

#include "FvDragonSmashingGolemQb.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "RenderComponent.h"
#include "Entity.h"
#include "eQuickBuildState.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::OnQuickBuildNotifyState(Entity* self, eQuickBuildState state) {
if (state == eQuickBuildState::COMPLETED) {
RenderComponent::PlayAnimation(self, u"dragonsmash");
const auto dragonId = self->GetVar<LWOOBJID>(u"Dragon");
auto* dragon = Game::entityManager->GetEntity(dragonId);
if (dragon != nullptr) {
dragon->OnFireEventServerSide(self, "rebuildDone");
}
self->CancelTimer("GolemBreakTimer");
self->AddTimer("GolemBreakTimer", 10.5f);
}
}