What's the radius where enemy structures block building?
Posted: Fri Dec 17, 2021 10:54 am
It's not possible to build something near a military structure of an enemy force (e.g. radars, turrets, spawners). It seems the radius where enemy military structures block building is 50 tiles. Is that indeed a hard-coded value, or could it be changed?
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
and use
to build it. But this would only work with the correct radius. (In multiplayer games with at least two enemy forces there may be situations where the entity still couldn't be placed. The workaround for that is suggestion: Don't tell the players an entity will be placed, but that there's a chance -- with an adjustable probability of 0<p<1 -- it could be placed.)
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