2021-12-05 17:54:36 +00:00
|
|
|
#include "NsQbImaginationStatue.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
|
|
|
|
void NsQbImaginationStatue::OnStartup(Entity* self) {
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2023-12-29 04:24:30 +00:00
|
|
|
void NsQbImaginationStatue::OnQuickBuildComplete(Entity* self, Entity* target) {
|
2021-12-05 17:54:36 +00:00
|
|
|
if (target == nullptr) return;
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->SetVar(u"Player", target->GetObjectID());
|
|
|
|
|
|
|
|
SpawnLoot(self);
|
|
|
|
|
|
|
|
self->AddTimer("SpawnDelay", 1.5f);
|
|
|
|
|
|
|
|
self->AddTimer("StopSpawner", 10.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NsQbImaginationStatue::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
if (timerName == "SpawnDelay") {
|
|
|
|
SpawnLoot(self);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer("SpawnDelay", 1.5f);
|
|
|
|
} else if (timerName == "StopSpawner") {
|
|
|
|
self->CancelAllTimers();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void NsQbImaginationStatue::SpawnLoot(Entity* self) {
|
|
|
|
const auto playerId = self->GetVar<LWOOBJID>(u"Player");
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* player = Game::entityManager->GetEntity(playerId);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
if (player == nullptr) return;
|
|
|
|
|
|
|
|
GameMessages::SendDropClientLoot(player, self->GetObjectID(), 935, 0);
|
|
|
|
GameMessages::SendDropClientLoot(player, self->GetObjectID(), 935, 0);
|
|
|
|
}
|