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

# Factorio Prototype Docs Version 2.0.7

## AutoplaceSpecification :: struct

Autoplace specification is used to determine which entities are placed when generating map. Currently it is used for enemy bases, tiles, resources and other entities (trees, fishes, etc.).

Autoplace specification describe conditions for placing tiles, entities, and decoratives during surface generation. Autoplace specification defines probability of placement on any given tile and richness, which has different meaning depending on the thing being placed.

## Properties

- default
- sorted

control optional | :: AutoplaceControlID | Name of the AutoplaceControl (row in the map generator GUI) that applies to this entity.
Name of the AutoplaceControl (row in the map generator GUI) that applies to this entity.
default_enabled optional | :: bool | Indicates whether the thing should be placed even if MapGenSettings do not provide frequency/size/richness for it. [...]
Indicates whether the thing should be placed even if MapGenSettings do not provide frequency/size/richness for it. [...]
force optional | :: `"enemy"` or `"player"` or `"neutral"` or string | Force of the placed entity. [...]
Force of the placed entity. [...]
order optional | :: Order | Order for placing the entity (has no effect when placing tiles). [...]
Order for placing the entity (has no effect when placing tiles). [...]
placement_density optional | :: uint32 | For entities and decoratives, how many times to attempt to place on each tile. [...]
For entities and decoratives, how many times to attempt to place on each tile. [...]
tile_restriction optional | :: array[TileIDRestriction] | Restricts tiles or tile transitions the entity can appear on.
Restricts tiles or tile transitions the entity can appear on.
probability_expression | :: NoiseExpression | Provides a noise expression that will be evaluated at every point on the map to determine probability.
Provides a noise expression that will be evaluated at every point on the map to determine probability.
richness_expression optional | :: NoiseExpression | If specified, provides a noise expression that will be evaluated to determine richness. [...]
If specified, provides a noise expression that will be evaluated to determine richness. [...]
local_expressions optional | :: dictionary[string → NoiseExpression] | A map of expression name to expression. [...]
A map of expression name to expression. [...]
local_functions optional | :: dictionary[string → NoiseFunction] | A map of function name to function. [...]
A map of function name to function. [...]

probability_expression | :: NoiseExpression | Provides a noise expression that will be evaluated at every point on the map to determine probability.
Provides a noise expression that will be evaluated at every point on the map to determine probability.
control optional | :: AutoplaceControlID | Name of the AutoplaceControl (row in the map generator GUI) that applies to this entity.
Name of the AutoplaceControl (row in the map generator GUI) that applies to this entity.
default_enabled optional | :: bool | Indicates whether the thing should be placed even if MapGenSettings do not provide frequency/size/richness for it. [...]
Indicates whether the thing should be placed even if MapGenSettings do not provide frequency/size/richness for it. [...]
force optional | :: `"enemy"` or `"player"` or `"neutral"` or string | Force of the placed entity. [...]
Force of the placed entity. [...]
local_expressions optional | :: dictionary[string → NoiseExpression] | A map of expression name to expression. [...]
A map of expression name to expression. [...]
local_functions optional | :: dictionary[string → NoiseFunction] | A map of function name to function. [...]
A map of function name to function. [...]
order optional | :: Order | Order for placing the entity (has no effect when placing tiles). [...]
Order for placing the entity (has no effect when placing tiles). [...]
placement_density optional | :: uint32 | For entities and decoratives, how many times to attempt to place on each tile. [...]
For entities and decoratives, how many times to attempt to place on each tile. [...]
richness_expression optional | :: NoiseExpression | If specified, provides a noise expression that will be evaluated to determine richness. [...]
If specified, provides a noise expression that will be evaluated to determine richness. [...]
tile_restriction optional | :: array[TileIDRestriction] | Restricts tiles or tile transitions the entity can appear on.
Restricts tiles or tile transitions the entity can appear on.

## Properties

### control :: AutoplaceControlID optional

Name of the AutoplaceControl (row in the map generator GUI) that applies to this entity.

### default_enabled :: bool optional

Default: `true`

Indicates whether the thing should be placed even if MapGenSettings do not provide frequency/size/richness for it. (either for the specific prototype or for the control named by AutoplaceSpecification.control).

If true, normal frequency/size/richness (`value=1`) are used in that case. Otherwise it is treated as if 'none' were selected.

### force :: `"enemy"` or `"player"` or `"neutral"` or string optional

Default: `"neutral"`

Force of the placed entity. Can be a custom force name. Only relevant for EntityWithOwnerPrototype.

### order :: Order optional

Default: `""`

Order for placing the entity (has no effect when placing tiles). Entities whose order compares less are placed earlier (this influences placing multiple entities which collide with itself), from entities with equal order string only one with the highest probability is placed.

### placement_density :: uint32 optional

Default: `1`

For entities and decoratives, how many times to attempt to place on each tile. Probability and collisions are taken into account each attempt.

### tile_restriction :: array[TileIDRestriction] optional

Restricts tiles or tile transitions the entity can appear on.

#### TileIDRestriction :: TileID or {TileID, TileID}

Name of an allowed tile, or a list of two tile names for entities allowed on transitions.

### probability_expression :: NoiseExpression

Provides a noise expression that will be evaluated at every point on the map to determine probability.

### richness_expression :: NoiseExpression optional

If specified, provides a noise expression that will be evaluated to determine richness. Otherwise, `probability_expression` will be used instead.

### local_expressions :: dictionary[string → NoiseExpression] optional

A map of expression name to expression. Used by `probability_expression` and `richness_expression`.

Local expressions are meant to store data locally similar to local variables in Lua. Their purpose is to hold noise expressions used multiple times in the named noise expression, or just to tell the reader that the local expression has a specific purpose. Local expressions can access other local definitions and also function parameters, but recursive definitions aren't supported.

### local_functions :: dictionary[string → NoiseFunction] optional

A map of function name to function. Used by `probability_expression` and `richness_expression`.

Local functions serve the same purpose as local expressions - they aren't visible outside of the specific prototype and they have access to other local definitions.

Type used in

- DecorativePrototype::autoplace
- EntityPrototype::autoplace
- TilePrototype::autoplace