Types/Sound: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Changed links going to the redirect Types/uint to go to Types/uint32.)
(Prototype property type usage)
(One intermediate revision by the same user not shown)
Line 1: Line 1:
==Basics==
==Basics==
This type is used to produce sound from in-game entities, ambient sound, and music.
This type is either a table with the properties listed in [[#Optional properties]], or an array of tables with the following members:
== Mandatory properties ==
* filename - [[Types/FileName]] - Mandatory.
===filename===
* volume - [[Types/float]] - Optional. - Default: 1.0
* preload - [[Types/bool]] - Optional.
 
== Optional properties ==
=== aggregation ===
'''Type''': [[Types/table]]
 
Table with the following members:
* max_count - [[Types/uint32]] - Mandatory.
* progress_threshold - [[Types/float]] - Optional. - Default: 1.0 - If count already playing is true, this will determine maximum progress when instance is counted toward playing sounds.
* remove - [[Types/bool]] - Mandatory.
* count_already_playing - [[Types/bool]] - Optional. - Default: false - If true already playing sounds are taken into account when checking maxCount.
 
=== audible_distance_modifier ===
'''Type''': [[Types/double]]
 
'''Default''': 1.0
 
=== variations ===
'''Type''': [[Types/table]] of [[Types/table]]s
 
Array of tables with the following members:
* filename - [[Types/FileName]] - Mandatory.
* volume - [[Types/float]] - Optional. - Default: 1.0
* preload - [[Types/bool]] - Optional.
 
=== filename ===
'''Type''': [[Types/FileName]]
'''Type''': [[Types/FileName]]


Used to let the game know what audio file you want it to use.
Mandatory if <code>variations</code> is not given.


===volume===
=== volume ===
'''Type''': [[Types/uint32]]
'''Type''': [[Types/float]]


Decides how loud the audio is.
'''Default''': 1.0
 
Only loaded if <code>variations</code> is not given.
 
=== preload ===
'''Type''': [[Types/bool]]
 
Only loaded if <code>variations</code> is not given.


==Example==
==Example==
Line 17: Line 50:
       volume = 1.2
       volume = 1.2
     }
     }
{{Prototype property type usage|{{FULLPAGENAME}}}}

Revision as of 17:14, 8 August 2019

Basics

This type is either a table with the properties listed in #Optional properties, or an array of tables with the following members:

Optional properties

aggregation

Type: Types/table

Table with the following members:

  • max_count - Types/uint32 - Mandatory.
  • progress_threshold - Types/float - Optional. - Default: 1.0 - If count already playing is true, this will determine maximum progress when instance is counted toward playing sounds.
  • remove - Types/bool - Mandatory.
  • count_already_playing - Types/bool - Optional. - Default: false - If true already playing sounds are taken into account when checking maxCount.

audible_distance_modifier

Type: Types/double

Default: 1.0

variations

Type: Types/table of Types/tables

Array of tables with the following members:

filename

Type: Types/FileName

Mandatory if variations is not given.

volume

Type: Types/float

Default: 1.0

Only loaded if variations is not given.

preload

Type: Types/bool

Only loaded if variations is not given.

Example

   {
     filename = "__base__/sound/ambient/world-ambience-3.ogg",
     volume = 1.2
   }

Prototype properties that use this type