fix: ape anchor not respawning (#1927)

* fix: ape anchor not respawning

* add return

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
David Markowitz
2025-11-15 13:30:02 -08:00
committed by GitHub
parent 96089a8d9a
commit 2fb16420f3
6 changed files with 27 additions and 1 deletions

View File

@@ -92,7 +92,7 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
new LDFData<LWOOBJID>(u"ape", self->GetObjectID())
};
auto* anchor = Game::entityManager->CreateEntity(entityInfo);
auto* anchor = Game::entityManager->CreateEntity(entityInfo, nullptr, self);
Game::entityManager->ConstructEntity(anchor);
self->SetVar<LWOOBJID>(u"QB", anchor->GetObjectID());
@@ -140,3 +140,9 @@ void BaseEnemyApe::StunApe(Entity* self, bool stunState) {
self->SetBoolean(u"knockedOut", stunState);
}
}
void BaseEnemyApe::OnChildRemoved(Entity& self, GameMessages::ChildRemoved& childRemoved) {
if (self.GetVar<LWOOBJID>(u"QB") == childRemoved.childID) {
self.SetVar<LWOOBJID>(u"QB", LWOOBJID_EMPTY);
}
}

View File

@@ -10,6 +10,7 @@ public:
void OnTimerDone(Entity* self, std::string timerName) override;
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
int32_t param3) override;
void OnChildRemoved(Entity& self, GameMessages::ChildRemoved& childRemoved) override;
private:
static void StunApe(Entity* self, bool stunState);
};