[Donion] [1.1.74] surface.play_sound override_sound_type has no effect

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

[Donion] [1.1.74] surface.play_sound override_sound_type has no effect

Post by Deadlock989 »

While trying to get to the bottom of this random missing sound problem, I noticed the documentation for SoundType suggests that "some sound types are mixed differently than others, e.g. zoom level effects are applied" and wondered if that was causing my issues. So I experimented with setting sound types in the override_sound_type property of surface.play_sound(), with the debug menu "show-recently-played-sound-info" setting on.

It seems that the override_sound_type property has no effect at all. If you set it to a garbage value (not a member of the SoundType union), the game halts with a script error, detecting the illegal value. But otherwise, the sounds produced are always of the type specified in the sound prototype ("game-effect" by default).

To reproduce, set all of your volume sliders except Master and Game effects to zero, turn on the recently played sound info F4 debug setting, and try the following:

Code: Select all

/c game.player.surface.play_sound{path="utility/build_small",position=game.player.position,override_sound_type="game-effect"}
/c game.player.surface.play_sound{path="utility/build_small",position=game.player.position,override_sound_type="environment"}
/c game.player.surface.play_sound{path="utility/build_small",position=game.player.position,override_sound_type="alert"}
You will hear all three even though Environment and Alert have been muted and the debug info will show "game-effect" each time.

Edited to add, this seems to be the case for both LuaSurface.play_sound() and LuaPlayer.play_sound(), and for sounds of both types utility-sounds and sound.
Image

Donion
Factorio Staff
Factorio Staff
Posts: 173
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [1.1.74] surface.play_sound override_sound_type has no effect

Post by Donion »

Thank you for the report. I've fumbled this with the SDL backend. It's now fixed for the next release.

Also, the recently-played-sound-info now shows the overridden type, although note that the entries in the list linger for 3s after the sound stops playing and if you play the same sound again within that time with a different override sound type, it will keep showing the previous one.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: [Donion] [1.1.74] surface.play_sound override_sound_type has no effect

Post by Deadlock989 »

Thanks for this.
Image

Post Reply

Return to “Resolved Problems and Bugs”