[0.15.5] attack area targets indestructible entities
Posted: Sun Apr 30, 2017 11:03 pm
The situation is:
***NOTE When I say biter I mean a unit group with at least one unit.
A biter kills a chunk of rail, the on death fires with the entity
The biter that killed the rail moves to the next rail until all in the area are gone, at which point the rails have all been remade with destructible=false.
The next unit group of biters passes by the indestructible rails and begins attacking them.
I control biter movement through attack area commands with distraction by_enemy or by_anything and never set individual targets.
***NOTE When I say biter I mean a unit group with at least one unit.
A biter kills a chunk of rail, the on death fires with the entity
Code: Select all
local repairPosition = entity.position
local repairName = entity.name
local repairForce = entity.force
local repairDirection = entity.direction
entity.destroy()
local entityRepaired = surface.create_entity({position=repairPosition,
name=repairName,
direction=repairDirection,
force=repairForce})
entityRepaired.destructible = false
The next unit group of biters passes by the indestructible rails and begins attacking them.
I control biter movement through attack area commands with distraction by_enemy or by_anything and never set individual targets.