When using play_sound() without a position then the sound should play "everywhere" according to the documentation, but this is only true for some sounds. Also I can't see any rule which sounds are affected and which are not.
Expected behavior
Sounds played without position should always be unaffected by zoom.
Explanation
For my screenshot mod i'm trying to play some sounds upon certain player interactions, which happens at possibly very high zoom-out. So i need a reliable way to play sounds in a zoom independant way. At first i thought only modded "sound" prototypes are affected, but during writing of this post i noticed that some build-in sounds are also affected. I also tried the prototype modifier "audible_distance_modifier" but setting it to either 0 / 1 / 10 did not affect the result.
Reproduction
Use the command or the demo mod (best on a new map where there are no other distracting noises). The script will slowly zoom out while playing sounds. You will notice that the inventory related sounds are always the same volume, but the build sound and the modded sound fade out until they're inaudible.
Code: Select all
/c
local zoom,k = {4,2,1,1/2,1/4,1/8,1/16}
local nx = function() repeat k = next(zoom,k) until k return zoom[k] end
script.on_nth_tick(30, function(e)
local p = game.players[1]
if e.tick % 60 == 30 then
p.zoom = nx()
else
--[[unaffected by zoom]]
p.play_sound{path = 'utility/inventory_click', volume_modifier = 1}
p.play_sound{path = 'utility/inventory_move', volume_modifier = 1}
--[[affected by zoom]]
p.play_sound{path = 'utility/build_large', volume_modifier = 1}
end
end)