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

# Factorio Prototype Docs Version 2.0.7

## VariableAmbientSoundState :: struct

## Properties

- default
- sorted

name | :: string | Name has to be unique across all states.
Name has to be unique across all states.
type optional | :: VariableAmbientSoundStateType |
next_state optional | :: string | Cannot be defined if `next_states` is defined. [...]
Cannot be defined if `next_states` is defined. [...]
next_states optional | :: array[VariableAmbientSoundNextStateItem] | Cannot be defined if `next_state` is defined. [...]
Cannot be defined if `next_state` is defined. [...]
next_state_trigger optional | :: VariableAmbientSoundNextStateTrigger | Mandatory if there is more than one state or if the only state transitions to itself. [...]
Mandatory if there is more than one state or if the only state transitions to itself. [...]
next_state_layers_finished_layers optional | :: array[string] | List of name of layers used to trigger state transition. [...]
List of name of layers used to trigger state transition. [...]
state_duration_seconds optional | :: uint32 | Defines for how long this state will be active. [...]
Defines for how long this state will be active. [...]
layers_properties optional | :: array[VariableAmbientSoundLayerStateProperties] | Must contain as many items as there is layers in the variable track. [...]
Must contain as many items as there is layers in the variable track. [...]
start_pause optional | :: RandomRange | Pause before a layer starts playing. [...]
Pause before a layer starts playing. [...]
end_pause optional | :: RandomRange | Pause before a layer finishes playing. [...]
Pause before a layer finishes playing. [...]
number_of_enabled_layers optional | :: RandomRange | Defines how many layers will be playing. [...]
Defines how many layers will be playing. [...]

name | :: string | Name has to be unique across all states.
Name has to be unique across all states.
end_pause optional | :: RandomRange | Pause before a layer finishes playing. [...]
Pause before a layer finishes playing. [...]
layers_properties optional | :: array[VariableAmbientSoundLayerStateProperties] | Must contain as many items as there is layers in the variable track. [...]
Must contain as many items as there is layers in the variable track. [...]
next_state optional | :: string | Cannot be defined if `next_states` is defined. [...]
Cannot be defined if `next_states` is defined. [...]
next_state_layers_finished_layers optional | :: array[string] | List of name of layers used to trigger state transition. [...]
List of name of layers used to trigger state transition. [...]
next_state_trigger optional | :: VariableAmbientSoundNextStateTrigger | Mandatory if there is more than one state or if the only state transitions to itself. [...]
Mandatory if there is more than one state or if the only state transitions to itself. [...]
next_states optional | :: array[VariableAmbientSoundNextStateItem] | Cannot be defined if `next_state` is defined. [...]
Cannot be defined if `next_state` is defined. [...]
number_of_enabled_layers optional | :: RandomRange | Defines how many layers will be playing. [...]
Defines how many layers will be playing. [...]
start_pause optional | :: RandomRange | Pause before a layer starts playing. [...]
Pause before a layer starts playing. [...]
state_duration_seconds optional | :: uint32 | Defines for how long this state will be active. [...]
Defines for how long this state will be active. [...]
type optional | :: VariableAmbientSoundStateType |

## Properties

### name :: string

Name has to be unique across all states.

### type :: VariableAmbientSoundStateType optional

Default: `"regular"`

### next_state :: string optional

Cannot be defined if `next_states` is defined.

Doesn't need to be defined if there is only one state.

### next_states :: array[VariableAmbientSoundNextStateItem] optional

Cannot be defined if `next_state` is defined.

Cannot be defined if there is only one state.

Cannot be empty.

### next_state_trigger :: VariableAmbientSoundNextStateTrigger optional

Mandatory if there is more than one state or if the only state transitions to itself.

Can be defined for `regular` states only.

### next_state_layers_finished_layers :: array[string] optional

List of name of layers used to trigger state transition.

Only loaded, and mandatory if `next_state_trigger` is `"layers-finished"`.

### state_duration_seconds :: uint32 optional

Defines for how long this state will be active.

Mandatory if `next_state_trigger` is `"duration"`.

Optionally loaded for `intermezzo` states.

### layers_properties :: array[VariableAmbientSoundLayerStateProperties] optional

Must contain as many items as there is layers in the variable track. The items themselves can be empty. The order of items corresponds to the order of layers as they appear in the prototype definition.

Mandatory for `regular` and `final` states.

Cannot be defined for `intermezzo` or `stop` states.

### start_pause :: RandomRange optional

Pause before a layer starts playing.

Optionally loaded for `intermezzo` states.

### end_pause :: RandomRange optional

Pause before a layer finishes playing. The layer being finished is not counted until the pause finishes.

Optionally loaded for `intermezzo` states.

### number_of_enabled_layers :: RandomRange optional

Defines how many layers will be playing. Which layers will be playing is selected randomly.

The minimum cannot be zero, the maximum cannot be greater than the number of layers.

Cannot be defined if any of `layers_properties` define the `enabled` property.

Cannot be defined for `intermezzo` or `stop` states.

Type used in

- VariableAmbientSoundVariableSound::states