Prototype/Sound: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Documented support sound file formats)
(Removed old prototype docs)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Prototype parent}}
<div class="stub"><p>'''The prototype docs have moved to a new website with an improved format.''' This documentation page can now be found here: [https://lua-api.factorio.com/latest/prototypes/SoundPrototype.html https://lua-api.factorio.com/latest/prototypes/SoundPrototype.html]
Specifies a sound that can be used with https://lua-api.factorio.com/latest/Concepts.html#SoundPath during runtime.


{{Prototype TOC|sound}}
</p><p>This wiki page is no longer updated and '''will be removed at some point in the future''', so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback [https://forums.factorio.com/viewforum.php?f=233 on the forums].</p></div>
 
== Mandatory properties ==
 
{{Prototype property|type|[[Types/string|string]]}}
Must be "sound".
 
{{Prototype property|name|[[Types/string|string]]}}
Name of the sound. Must be unique. Used as a https://lua-api.factorio.com/latest/Concepts.html#SoundPath.
 
== Optional properties ==
 
{{Prototype property|category|[[Types/string|string]]|"game-effect"|optional=true}}
One of "game-effect", "gui-effect", "ambient", "environment", "walking", "alert" and "wind".
 
{{Prototype property|aggregation|[[Types/table|table]]|optional=true}}
Table with the following members:
* max_count - [[Types/uint32|uint32]] - Mandatory.
* progress_threshold - [[Types/float|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|bool]] - Mandatory.
* count_already_playing - [[Types/bool|bool]] - Optional. - Default: false - If true already playing sounds are taken into account when checking maxCount.
 
{{Prototype property|allow_random_repeat|[[Types/bool|bool]]|false|optional=true}}
 
{{Prototype property|audible_distance_modifier|[[Types/double|double]]|1.0|optional=true}}
 
{{Prototype property|variations|[[Types/table|table]] (array) of [[Types/table|table]]s|optional=true}}
Array of tables with the following members:
* filename - [[Types/FileName|FileName]] - Mandatory. Support sound file formats are <code>.ogg</code>, <code>.wav</code> and <code>.voc</code>.
* volume - [[Types/float|float]] - Optional. - Default: 1.0
* preload - [[Types/bool|bool]] - Optional.
* speed - [[Types/float|float]] - Optional. - Default: 1.0 - Speed must be >= 1 / 64. This sets both min and max speed.
* min_speed - [[Types/float|float]] - Optional. Not loaded if speed is present. - Default: 1.0 - Speed must be >= 1 / 64.
* max_speed - [[Types/float|float]] - Mandatory if min_speed is present, otherwise not loaded. - Default: 1.0 - Must be >= min_speed.
 
{{Prototype property|filename|[[Types/FileName|FileName]]|optional=true}}
Mandatory if <code>variations</code> is not given.
 
Support sound file formats are <code>.ogg</code>, <code>.wav</code> and <code>.voc</code>.
 
{{Prototype property|volume|[[Types/float|float]]|1.0|optional=true}}
Only loaded if <code>variations</code> is not given.
 
{{Prototype property|preload|[[Types/bool|bool]]|optional=true}}
Only loaded if <code>variations</code> is not given.
 
{{Prototype property|speed|[[Types/float|float]]|1.0|optional=true}}
Only loaded if <code>variations</code> is not given. Speed must be >= 1 / 64. This sets both min and max speed.
 
{{Prototype property|min_speed|[[Types/float|float]]|1.0|optional=true}}
Only loaded if <code>variations</code> is not given. Not loaded if speed is present. Speed must be >= 1 / 64.
 
{{Prototype property|max_speed|[[Types/float|float]]|1.0|optional=true}}
Only loaded if <code>variations</code> is not given. Mandatory if min_speed is present, otherwise not loaded. Must be >= min_speed.

Latest revision as of 14:33, 25 October 2024

The prototype docs have moved to a new website with an improved format. This documentation page can now be found here: https://lua-api.factorio.com/latest/prototypes/SoundPrototype.html

This wiki page is no longer updated and will be removed at some point in the future, so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback on the forums.