I'm wanting to write a simple mod to let you say "this turret shoots the thing farthest away, this one shoots the thing nearest" and looking through the documentation I can't see how to do it.
Is there a mod that already does this, or is it something we can't do?
Why:
I want to set up a combined defence line where the laser turrets prioritise the stuff that stays at range (currently just spitters), and the bullet turrets take the stuff against the wall.
Wanting to adjust turret targeting priorities
-
- Filter Inserter
- Posts: 530
- Joined: Mon Feb 05, 2018 10:01 am
- Contact:
Re: Wanting to adjust turret targeting priorities
AFAIK turrets don't have a prioritising mechanic built in, so you would have to simulate it.
You can set the shootng target of a turret using LuaEntity::shooting_target
Although I don't know how this could be used in a way that doesn't completely kill your performance.
Maybe use the events on_entity_damaged and on_entity_died with the cause parameter to script the desired behaviour.
You can set the shootng target of a turret using LuaEntity::shooting_target
Although I don't know how this could be used in a way that doesn't completely kill your performance.
Maybe use the events on_entity_damaged and on_entity_died with the cause parameter to script the desired behaviour.
My mods: