2021-12-05 17:54:36 +00:00
|
|
|
#include "FvDragonSmashingGolemQb.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "EntityManager.h"
|
2023-03-20 13:10:52 +00:00
|
|
|
#include "RenderComponent.h"
|
|
|
|
#include "Entity.h"
|
2023-12-29 04:24:30 +00:00
|
|
|
#include "eQuickBuildState.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void FvDragonSmashingGolemQb::OnStartup(Entity* self) {
|
|
|
|
self->AddTimer("GolemBreakTimer", 10.5f);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void FvDragonSmashingGolemQb::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
if (timerName == "GolemBreakTimer") {
|
|
|
|
self->Smash();
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2023-12-29 04:24:30 +00:00
|
|
|
void FvDragonSmashingGolemQb::OnQuickBuildNotifyState(Entity* self, eQuickBuildState state) {
|
|
|
|
if (state == eQuickBuildState::COMPLETED) {
|
2023-03-20 13:10:52 +00:00
|
|
|
RenderComponent::PlayAnimation(self, u"dragonsmash");
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
const auto dragonId = self->GetVar<LWOOBJID>(u"Dragon");
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* dragon = Game::entityManager->GetEntity(dragonId);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (dragon != nullptr) {
|
|
|
|
dragon->OnFireEventServerSide(self, "rebuildDone");
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
self->CancelTimer("GolemBreakTimer");
|
|
|
|
self->AddTimer("GolemBreakTimer", 10.5f);
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|