Use case:
I want to place invisible, indestructible entities even if that was near an enemy military structure. To circumvent the block, I'd first check if I can place the entity; if not, I'd get the force of the first entity returned by
Code: Select all
surface.find_entities_filtered{
position = position,
radius = 50,
type = {"ammo-turret", "artillery-turret", "electric-turret", "fluid-turret", "turret", "radar", "unit-spawner"}
}
and use
Code: Select all
new_entity = surface.create_entity({
name = entity_name,
position = position,
force = enemy_force_name,
})
if new_entity then
new_entity.force = final_force_name
new_entity.destructible = false
end