Factorio Prototype DocsVersion 1.1.107

SimulationDefinition :: struct

Used by tips and tricks and main menu simulations.

There are a few simulation-only APIs:

game.create_test_player{name=string}
game.activate_rail_planner{position=position,ghost_mode=bool}
game.deactivate_rail_planner()
game.move_cursor{position=position,speed=number}  -- should be called every tick; returns true when target is reached
game.activate_selection()
game.finish_selection()
game.deactivate_selection()
game.scroll_clipboard_forwards()
game.scroll_clipboard_backwards()
game.camera_player_cursor_position [RW]
game.camera_position [RW]
game.camera_zoom [W]
game.camera_player [W]
game.camera_player_cursor_direction [W]
game.camera_alt_info [W]
game.smart_belt_building [W]
player.drag_start_position [W]
player.raw_build_from_cursor{ghost_mode=bool,created_by_moving=bool,position=position}
surface.create_entities_from_blueprint_string{string=string,position=position,force=force,direction=defines.direction,flip_horizonal=bool,flip_vertical=bool,by_player=player}

Properties

save optional :: FileName

The save file that is used for this simulation. [...]

The save file that is used for this simulation. [...]

init_file optional :: FileName

This code is run as a (silent) console command inside the simulation when it is first initialized. [...]

This code is run as a (silent) console command inside the simulation when it is first initialized. [...]

init optional :: string

Only loaded if init_file is not defined. [...]

Only loaded if init_file is not defined. [...]

update_file optional :: FileName

This code is run as a (silent) console command inside the simulation every time the simulation is updated. [...]

This code is run as a (silent) console command inside the simulation every time the simulation is updated. [...]

update optional :: string

Only loaded if update_file is not defined. [...]

Only loaded if update_file is not defined. [...]

mods optional :: array[string]

An array of mods that will be run in this simulation if they are present and enabled.

An array of mods that will be run in this simulation if they are present and enabled.

init_update_count optional :: uint32

Amount of ticks that this simulation should run for before the simulation is shown to the player. [...]

Amount of ticks that this simulation should run for before the simulation is shown to the player. [...]

length optional :: uint32

How long this simulation takes. [...]

How long this simulation takes. [...]

generate_map optional :: bool

If save is not given and this is true, a map gets generated by the game for use in the simulation.

If save is not given and this is true, a map gets generated by the game for use in the simulation.

checkboard optional :: bool

If this is true, the map of the simulation is set to be a lab-tile checkerboard in the area of {{-20, -15},{20, 15}} when the scenario is first initialized (before init/init_file run).

If this is true, the map of the simulation is set to be a lab-tile checkerboard in the area of {{-20, -15},{20, 15}} when the scenario is first initialized (before init/init_file run).

volume_modifier optional :: float

Multiplier for the simulation volume set by the player in the sound settings.

Multiplier for the simulation volume set by the player in the sound settings.

override_volume optional :: bool

If true, overrides the simulation volume set by the player in the sound settings, simply setting the volume modifier to 1.

If true, overrides the simulation volume set by the player in the sound settings, simply setting the volume modifier to 1.

Properties

save :: FileName optional

The save file that is used for this simulation. If not given and generate_map is true, a map is generated by the game.

init_file :: FileName optional

This code is run as a (silent) console command inside the simulation when it is first initialized. Since this is run as a console command, the restrictions of console commands apply, e.g. require is not available, see here.

init :: string optional

Default: ""

Only loaded if init_file is not defined.

This code is run as a (silent) console command inside the simulation when it is first initialized. Since this is run as a console command, the restrictions of console commands apply, e.g. require is not available, see here.

update_file :: FileName optional

This code is run as a (silent) console command inside the simulation every time the simulation is updated. Since this is run as a console command, the restrictions of console commands apply, e.g. require is not available, see here.

update :: string optional

Default: ""

Only loaded if update_file is not defined.

This code is run as a (silent) console command inside the simulation every time the simulation is updated. Since this is run as a console command, the restrictions of console commands apply, e.g. require is not available, see here.

mods :: array[string] optional

An array of mods that will be run in this simulation if they are present and enabled.

init_update_count :: uint32 optional

Default: 0

Amount of ticks that this simulation should run for before the simulation is shown to the player. These updates happen after init/init_file has been run and at the highest possible rate (> 60 UPS).

length :: uint32 optional

Default: 0

How long this simulation takes. In the main menu simulations, another simulation will start after this simulation ends.

generate_map :: bool optional

Default: false

If save is not given and this is true, a map gets generated by the game for use in the simulation.

checkboard :: bool optional

Default: true

If this is true, the map of the simulation is set to be a lab-tile checkerboard in the area of {{-20, -15},{20, 15}} when the scenario is first initialized (before init/init_file run).

volume_modifier :: float optional

Multiplier for the simulation volume set by the player in the sound settings.

override_volume :: bool optional

If true, overrides the simulation volume set by the player in the sound settings, simply setting the volume modifier to 1.

Prototypes

Types