fix: destroy enemies on entering build mode (#1812)

This commit is contained in:
David Markowitz 2025-06-08 19:41:19 -07:00 committed by GitHub
parent 37e14979a4
commit 2858345269
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -272,6 +272,10 @@ void PropertyManagementComponent::OnStartBuilding() {
model->HandleMsg(reset);
}
}
for (auto* const entity : Game::entityManager->GetEntitiesInGroup("SpawnedPropertyEnemies")) {
if (entity) entity->Smash();
}
}
void PropertyManagementComponent::OnFinishBuilding() {
@ -296,6 +300,10 @@ void PropertyManagementComponent::OnFinishBuilding() {
model->HandleMsg(reset);
}
}
for (auto* const entity : Game::entityManager->GetEntitiesInGroup("SpawnedPropertyEnemies")) {
if (entity) entity->Smash();
}
}
void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const NiPoint3 position, NiQuaternion rotation) {

View File

@ -111,7 +111,9 @@ void Strip::Spawn(LOT lot, Entity& entity) {
info.pos = entity.GetPosition();
info.rot = NiQuaternionConstant::IDENTITY;
info.spawnerID = entity.GetObjectID();
Game::entityManager->ConstructEntity(Game::entityManager->CreateEntity(info, nullptr, &entity));
auto* const spawnedEntity = Game::entityManager->CreateEntity(info, nullptr, &entity);
spawnedEntity->AddToGroup("SpawnedPropertyEnemies");
Game::entityManager->ConstructEntity(spawnedEntity);
}
// Spawns a specific drop for all