AI object which can be ordered commands. This can represent a UnitGroup (a set of multiple commandables) or can be a single Unit or SpiderUnit.
booleanunknownfalseIf this commandable is UnitGroup.
booleanunknownfalseIf this commandable is Entity.
LuaSurfaceunknownfalseSurface this commandable is on.
MapPositionunknownfalseCurrent position of this commandable.
If commandable is a UnitGroup, this can have different meanings depending on the group state. When the group is gathering, the position is the place of gathering. When the group is moving, the position is the expected position of its members along the path. When the group is attacking, it is the average position of its members.
LuaForceunknownfalseThe force of this commandable.
uint32unknownfalseUnique identifier of this commandable.
booleanunknownfalseIf this commandable has a command assigned.
CommandunknowntrueThe command of this commandable, if any.
CommandunknowntrueThe distraction command of this commandable, if any.
LuaCommandableunknowntrueThe unit group this commandable is a member of, if any.
LuaEntityunknowntrueThe spawner associated with this commandable, if any.
defines.moving_stateunknownfalseCurrent moving state of the commandable's behavior
defines.group_stateunknownfalseWhether this group is gathering, moving or attacking.
Array<LuaEntity>unknownfalseAll entity members of this unit group, recursive (if unit group is member of this unit group, its members will be returned here).
Array<LuaCommandable>unknownfalseNon recursively returns all members of this unit group.
booleanunknownfalseWhether this unit group is controlled by a script or by the game engine. This can be changed using LuaCommandable::set_autonomous. Units created by LuaSurface::create_unit_group are considered script-driven.
LuaEntityunknownfalseReturns entity object for this commandable.
booleanunknownfalseIs this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
stringunknownfalseThe class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
LuaCommandable.destroy()
commandable.destroy()
takes_table: falsetable_optional: falseDestroys this commandable. If it is a unit group, members will not be destroyed, they will be merely unlinked from the group.
LuaCommandable.set_command(command: Command)
commandable.set_command(command)
takes_table: falsetable_optional: falseGive this commandable a command.
command: CommandLuaCommandable.set_distraction_command(command: Command)
commandable.set_distraction_command(command)
takes_table: falsetable_optional: falseGive this commandable a distraction command.
command: CommandLuaCommandable.release_from_spawner()
commandable.release_from_spawner()
takes_table: falsetable_optional: falseRelease the commandable from the spawner. This allows the spawner to continue spawning additional units.
LuaCommandable.add_member(member: LuaCommandable | LuaEntity)
commandable.add_member(member)
takes_table: falsetable_optional: falseAdds a member to this UnitGroup. Has the same effect as setting defines.command.group command on the member to join the group.
The member must have the same force be on the same surface as the group.
member: LuaCommandable | LuaEntityLuaCommandable.set_autonomous()
commandable.set_autonomous()
takes_table: falsetable_optional: falseMake this group autonomous. Autonomous groups will automatically attack polluted areas. Autonomous groups aren't considered to be script-driven.
LuaCommandable.start_moving()
commandable.start_moving()
takes_table: falsetable_optional: falseMake the group start moving even if some of its members haven't yet arrived.