fix: ape anchor not respawning

This commit is contained in:
David Markowitz
2025-11-14 21:01:09 -08:00
parent ca60787055
commit 3fe1b431de
6 changed files with 26 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);
};