Types/WorkingSound: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(added activate_sound, deactivate_sound)
(0.18.17)
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
'''Type''': [[Types/Sound]]
'''Type''': [[Types/Sound]]


The sound to be played when the entity is working.
The sound to be played when the entity is working. If sound is not present, the entire WorkingSound is loaded as a [[Types/Sound]].


== Optional properties ==
== Optional properties ==
=== apparent_volume ===
=== apparent_volume ===
'''Type''': [[Types/float]]
'''Type''': [[Types/float]]
'''Default''': 1
=== max_sounds_per_type ===
'''Type''': [[Types/uint8]]
=== match_progress_to_activity ===
'''Type''': [[Types/bool]]
'''Default''': false
=== match_volume_to_activity ===
'''Type''': [[Types/bool]]
'''Default''': false
=== match_speed_to_activity ===
'''Type''': [[Types/bool]]
'''Default''': false
=== persistent ===
'''Type''': [[Types/bool]]
'''Default''': false
=== use_doppler_shift ===
'''Type''': [[Types/bool]]
'''Default''': true


=== audible_distance_modifier ===
=== audible_distance_modifier ===
'''Type''': [[Types/double]]
'''Type''': [[Types/double]]


Modifies how far a sound can be heard. Default is ? which means that the sound can be heard up to ? tiles away from the entity.
'''Default''': 1
 
Modifies how far a sound can be heard. Can only be 1 or lower, has to be a positive number.
 
=== probability ===
=== probability ===
'''Type''': [[Types/double]]
'''Type''': [[Types/double]]
'''Default''': 1


Modifies how often the sound is played. Example:
Modifies how often the sound is played. Example:
<syntaxhighlight lang="lua">probability = 1 / (3 * 60) -- average pause between the sound is 3 seconds</syntaxhighlight>
<syntaxhighlight lang="lua">probability = 1 / (3 * 60) -- average pause between the sound is 3 seconds</syntaxhighlight>
=== fade_in_ticks ===
'''Type''': [[Types/uint32]]
'''Default''': 0
Can't be used when match_progress_to_activity is true.
=== fade_out_ticks ===
'''Type''': [[Types/uint32]]
'''Default''': 0
Can't be used when match_progress_to_activity is true.


=== idle_sound ===
=== idle_sound ===
'''Type''': [[Types/Sound]]
'''Type''': [[Types/Sound]]


The sound to be played when the entity is idle. Might not work with all entities that use working_sound. Used by accumulator, assembling-machine, electric-energy-interface.
The sound to be played when the entity is idle. Might not work with all entities that use working_sound.


=== activate_sound ===
=== activate_sound ===
'''Type''': [[Types/Sound]]
'''Type''': [[Types/Sound]]


Might not work with all entities that use working_sound. Used by car.
Might not work with all entities that use working_sound.


=== deactivate_sound ===
=== deactivate_sound ===
'''Type''': [[Types/Sound]]
'''Type''': [[Types/Sound]]


Might not work with all entities that use working_sound. Used by car.
Might not work with all entities that use working_sound.
 
=== max_sounds_per_type ===
'''Type''': [[Types/uint8]]
 
=== match_progress_to_activity ===
'''Type''': [[Types/bool]]
 
=== match_volume_to_activity ===
'''Type''': [[Types/bool]]
 
=== match_speed_to_activity ===
'''Type''': [[Types/bool]]


==Example==
==Example==

Latest revision as of 11:48, 6 April 2020

Basics

This type is used to produce sound from in-game entities when they are working/idle.

Mandatory properties

sound

Type: Types/Sound

The sound to be played when the entity is working. If sound is not present, the entire WorkingSound is loaded as a Types/Sound.

Optional properties

apparent_volume

Type: Types/float

Default: 1

max_sounds_per_type

Type: Types/uint8

match_progress_to_activity

Type: Types/bool

Default: false

match_volume_to_activity

Type: Types/bool

Default: false

match_speed_to_activity

Type: Types/bool

Default: false

persistent

Type: Types/bool

Default: false

use_doppler_shift

Type: Types/bool

Default: true

audible_distance_modifier

Type: Types/double

Default: 1

Modifies how far a sound can be heard. Can only be 1 or lower, has to be a positive number.

probability

Type: Types/double

Default: 1

Modifies how often the sound is played. Example:

probability = 1 / (3 * 60) -- average pause between the sound is 3 seconds

fade_in_ticks

Type: Types/uint32

Default: 0

Can't be used when match_progress_to_activity is true.

fade_out_ticks

Type: Types/uint32

Default: 0

Can't be used when match_progress_to_activity is true.

idle_sound

Type: Types/Sound

The sound to be played when the entity is idle. Might not work with all entities that use working_sound.

activate_sound

Type: Types/Sound

Might not work with all entities that use working_sound.

deactivate_sound

Type: Types/Sound

Might not work with all entities that use working_sound.

Example

Refinery:

working_sound =
 {
  sound = { filename = "__base__/sound/oil-refinery.ogg" },
  idle_sound = { filename = "__base__/sound/idle1.ogg", volume = 0.6 },
  apparent_volume = 2.5,
 },

Roboport:

working_sound =
    {
      sound = { filename = "__base__/sound/roboport-working.ogg", volume = 0.6 },
      max_sounds_per_type = 3,
      audible_distance_modifier = 0.5,
      probability = 1 / (5 * 60) -- average pause between the sound is 5 seconds
    },