2021-12-05 17:54:36 +00:00
|
|
|
#include "GfApeSmashingQB.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "GameMessages.h"
|
2023-03-20 13:10:52 +00:00
|
|
|
#include "Entity.h"
|
|
|
|
#include "RenderComponent.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void GfApeSmashingQB::OnStartup(Entity* self) {
|
|
|
|
self->SetNetworkVar<LWOOBJID>(u"lootTagOwner", self->GetVar<LWOOBJID>(u"lootTagOwner"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void GfApeSmashingQB::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
if (timerName == "anchorBreakTime") {
|
|
|
|
self->Smash();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void GfApeSmashingQB::OnRebuildComplete(Entity* self, Entity* target) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* ape = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"ape"));
|
2021-12-05 17:54:36 +00:00
|
|
|
if (ape != nullptr) {
|
|
|
|
ape->OnFireEventServerSide(target, "rebuildDone");
|
2023-03-20 13:10:52 +00:00
|
|
|
RenderComponent::PlayAnimation(self, u"smash", 1.7f);
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer("anchorBreakTime", 1.0f);
|
|
|
|
}
|
|
|
|
}
|