mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-19 19:20:13 +00:00
Public release of the DLU server code!
Have fun!
This commit is contained in:
36
dScripts/FvDragonSmashingGolemQb.cpp
Normal file
36
dScripts/FvDragonSmashingGolemQb.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "FvDragonSmashingGolemQb.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.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::REBUILD_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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user