LuaEntity.get_target() + set target options

Post Reply
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 711
Joined: Sun Nov 23, 2014 11:57 am
Contact:

LuaEntity.get_target() + set target options

Post by Earendel »

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.

Danielv123
Inserter
Inserter
Posts: 48
Joined: Sun Jan 03, 2016 10:28 am
Contact:

Re: LuaEntity.get_target() + set target options

Post by Danielv123 »

There have been a lot of requests for scripts controlling turrets, I would advice searching around for an official response.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: LuaEntity.get_target() + set target options

Post by aubergine18 »

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.

Post Reply

Return to “Implemented mod requests”