positionless player.play_sound()

Coming soon!
Post Reply
User avatar
xaetral
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sun Apr 28, 2019 2:25 pm
Contact:

positionless player.play_sound()

Post by xaetral »

I have multiple mods that require or will require being able to play sounds to a player directly, without the sound having coordinates.

For example if I make some sort of user interface and use the player.play_sound() method, the sound is not audible if the player moves away from the coordinates it was when the method was called.

This has a lot of use cases: for example equipment like metal detector or a geiger counter, a gta-like radio in vehicles, and many more...

Xorimuth
Filter Inserter
Filter Inserter
Posts: 627
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: positionless player.play_sound()

Post by Xorimuth »

I think you can change https://lua-api.factorio.com/latest/pro ... e_modifier on the sound prototype to make it not affected by distance.
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

User avatar
xaetral
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sun Apr 28, 2019 2:25 pm
Contact:

Re: positionless player.play_sound()

Post by xaetral »

Thank you for the suggestion, sadly the value "must be" in the range [0;1] and 1 is still positioned on the game surface :/

curiosity
Filter Inserter
Filter Inserter
Posts: 330
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: positionless player.play_sound()

Post by curiosity »

Possible duplicate of viewtopic.php?f=221&t=64281

User avatar
xaetral
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sun Apr 28, 2019 2:25 pm
Contact:

Re: positionless player.play_sound()

Post by xaetral »

curiosity wrote:
Mon Oct 09, 2023 8:45 pm
Possible duplicate of viewtopic.php?f=221&t=64281
I don't think so, I've done a post search before doing this one and it seems like this topic is more about making a sound position follow an entity, which is different from my proposal of not having a position at all.

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

Re: positionless player.play_sound()

Post by Donion »

Hello,
Playing the sound as a global when a position is not defined makes sense to me. In fact, it already behaves like that in 2.0, the change happened as a part of some refactoring I was doing. I'll think about it a little more but I think I'll make the change in 1.1.x as well, I don't see a reason why it would need to default to the player's position (audio center, to be precise).

User avatar
Stringweasel
Filter Inserter
Filter Inserter
Posts: 321
Joined: Thu Apr 27, 2017 8:22 pm
Contact:

Re: positionless player.play_sound()

Post by Stringweasel »

That would be awesome! It's been requested here as well by me :) 98618
Alt-F4 Author | Factorio Modder
Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock | Weasel's Demolition Derby

User avatar
xaetral
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sun Apr 28, 2019 2:25 pm
Contact:

Re: positionless player.play_sound()

Post by xaetral »

Donion wrote:
Thu Oct 19, 2023 9:51 am
Hello,
Playing the sound as a global when a position is not defined makes sense to me. In fact, it already behaves like that in 2.0, the change happened as a part of some refactoring I was doing. I'll think about it a little more but I think I'll make the change in 1.1.x as well, I don't see a reason why it would need to default to the player's position (audio center, to be precise).
Thank you very much :D

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

Re: positionless player.play_sound()

Post by Donion »

Decision was made to leave it as is for 1.1, so stay tuned for 2.0.

Post Reply

Return to “Implemented for 2.0”