Factorio.com|Forums|Wiki|Mod Portal|API Docs Prototype|Runtime|Auxiliary

# Factorio Runtime Docs Version 2.0.7

## Command :: table

Commands can be given to enemies and unit groups.

#### Table fields

type | :: defines.command | Type of command. The remaining fields depend on the value of this field.
Type of command. The remaining fields depend on the value of this field.

Other attributes may be specified depending on `type`:

#### `defines.command.attack`

target | :: LuaEntity |
distraction | :: defines.distraction? | Defaults to `defines.distraction.by_enemy`.
Defaults to `defines.distraction.by_enemy`.

#### `defines.command.go_to_location`

destination | :: MapPosition? | The position to path to. Either this or `destination_entity` need to be specified. If both are, `destination_entity` is used.
The position to path to. Either this or `destination_entity` need to be specified. If both are, `destination_entity` is used.
destination_entity | :: LuaEntity? | The entity to path to. Either this or `destination` need to be specified. If both are, `destination_entity` is used.
The entity to path to. Either this or `destination` need to be specified. If both are, `destination_entity` is used.
distraction | :: defines.distraction? | Defaults to `defines.distraction.by_enemy`.
Defaults to `defines.distraction.by_enemy`.
pathfind_flags | :: PathfinderFlags? | Flags that affect pathfinder behavior.
Flags that affect pathfinder behavior.
radius | :: double? | How close the pathfinder needs to get to its destination (in tiles). Defaults to `3`.
How close the pathfinder needs to get to its destination (in tiles). Defaults to `3`.

#### `defines.command.compound`

structure_type | :: defines.compound_command | How the commands should be chained together.
How the commands should be chained together.
commands | :: array[Command] | The sub-commands.
The sub-commands.

#### `defines.command.group`

group | :: LuaCommandable | The group whose command to follow.
The group whose command to follow.
distraction | :: defines.distraction? | Defaults to `defines.distraction.by_enemy`.
Defaults to `defines.distraction.by_enemy`.
use_group_distraction | :: boolean? | Whether the unit will use the group distraction or the commands distraction. Defaults to true.
Whether the unit will use the group distraction or the commands distraction. Defaults to true.

#### `defines.command.attack_area`

destination | :: MapPosition | Center of the attack area.
Center of the attack area.
radius | :: double | Radius of the attack area.
Radius of the attack area.
distraction | :: defines.distraction? | Defaults to `defines.distraction.by_enemy`.
Defaults to `defines.distraction.by_enemy`.

#### `defines.command.wander`

distraction | :: defines.distraction? | Defaults to `defines.distraction.by_enemy`.
Defaults to `defines.distraction.by_enemy`.
radius | :: double? | Defaults to 10. Does not apply when `wander_in_group` is `true`.
Defaults to 10. Does not apply when `wander_in_group` is `true`.
wander_in_group | :: boolean? | When commanding a group, defines how the group will wander. When `true`, the units in the group will wander around inside the group's radius, just like gathering biters. When `false`, the units will wander as a group, ie they will all walk together in the same random direction. Default is true for groups. Passing true for a single unit is an error.
When commanding a group, defines how the group will wander. When `true`, the units in the group will wander around inside the group's radius, just like gathering biters. When `false`, the units will wander as a group, ie they will all walk together in the same random direction. Default is true for groups. Passing true for a single unit is an error.
ticks_to_wait | :: uint? | Ticks to wander before successfully completing the command. Default is max uint, which means wander forever.
Ticks to wander before successfully completing the command. Default is max uint, which means wander forever.

#### `defines.command.stop`

distraction | :: defines.distraction? | Defaults to `defines.distraction.by_enemy`.
Defaults to `defines.distraction.by_enemy`.
ticks_to_wait | :: uint? | Ticks to wander before successfully completing the command. Default is max uint, which means stop forever.
Ticks to wander before successfully completing the command. Default is max uint, which means stop forever.

#### `defines.command.flee`

from | :: LuaEntity | The entity to flee from
The entity to flee from
distraction | :: defines.distraction? | Defaults to `defines.distraction.by_enemy`.
Defaults to `defines.distraction.by_enemy`.

#### `defines.command.build_base`

destination | :: MapPosition | Where to build the base.
Where to build the base.
distraction | :: defines.distraction? | Defaults to `defines.distraction.by_enemy`.
Defaults to `defines.distraction.by_enemy`.
ignore_planner | :: boolean? | Whether the units should ignore expansion candidate chunks. When `false`, they will obey and not build a base in a non-candidate chunk. Defaults to `false`.
Whether the units should ignore expansion candidate chunks. When `false`, they will obey and not build a base in a non-candidate chunk. Defaults to `false`.