Please add for turret, unit, player, vehicle.
LuaEntity.get_target() → {entity=LuaEntity, position=Position}
If no target or not a turret, unit, player, vehicle the return value would be nil.
If targeting ground (shotgun/cannon) it would just be: {entity=nil, position=Position}
Also, LuaEntity.set_target_entity(entity = LuaEntity) would be useful for turrets and units.
And LuaEntity.fire_at_location(position = Position, fire_repeatedly = Bool) would be especially useful for anything with an AOE related, like shotgun tanks, grenade turrets, artillery, etc.
And if you're feeling particularly awesome: LuaEntity.ticks_since_last_attack:: uint [R] would also be very helpful.
LuaEntity.get_target() + set target options
-
- Inserter
- Posts: 48
- Joined: Sun Jan 03, 2016 10:28 am
- Contact:
Re: LuaEntity.get_target() + set target options
There have been a lot of requests for scripts controlling turrets, I would advice searching around for an official response.
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: LuaEntity.get_target() + set target options
A recent topic asking for similar stuff: viewtopic.php?f=28&t=35361
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.