Types/WorkingSound: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Created page with "==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 t...")
 
(Removed old prototype docs)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Basics==
<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/types/WorkingSound.html https://lua-api.factorio.com/latest/types/WorkingSound.html]
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.
</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>
 
== Optional properties ==
=== apparent_volume ===
'''Type''': [[Types/float]]
 
=== audible_distance_modifier ===
'''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.
=== probability ===
'''Type''': [[Types/double]]
 
Modifies how often the sound is played. Example:
<syntaxhighlight lang="lua">probability = 1 / (3 * 60) -- average pause between the sound is 3 seconds</syntaxhighlight>
 
=== 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.
 
=== 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==
 
Refinery:
<syntaxhighlight lang="lua">
working_sound =
{
  sound = { filename = "__base__/sound/oil-refinery.ogg" },
  idle_sound = { filename = "__base__/sound/idle1.ogg", volume = 0.6 },
  apparent_volume = 2.5,
},</syntaxhighlight>
 
Roboport:
<syntaxhighlight lang="lua">
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
    },
</syntaxhighlight>

Latest revision as of 14:32, 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/types/WorkingSound.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.