diff --git a/dGame/dComponents/PropertyManagementComponent.cpp b/dGame/dComponents/PropertyManagementComponent.cpp index f20a2886..25a7d036 100644 --- a/dGame/dComponents/PropertyManagementComponent.cpp +++ b/dGame/dComponents/PropertyManagementComponent.cpp @@ -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) { diff --git a/dGame/dPropertyBehaviors/Strip.cpp b/dGame/dPropertyBehaviors/Strip.cpp index b1dd94eb..5e90d2ba 100644 --- a/dGame/dPropertyBehaviors/Strip.cpp +++ b/dGame/dPropertyBehaviors/Strip.cpp @@ -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