Page 1 of 1
positionless player.play_sound()
Posted: Sun Oct 08, 2023 9:24 pm
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...
Re: positionless player.play_sound()
Posted: Sun Oct 08, 2023 9:42 pm
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.
Re: positionless player.play_sound()
Posted: Sun Oct 08, 2023 11:17 pm
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 :/
Re: positionless player.play_sound()
Posted: Mon Oct 09, 2023 8:45 pm
by curiosity
Re: positionless player.play_sound()
Posted: Tue Oct 10, 2023 2:53 pm
by xaetral
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.
Re: positionless player.play_sound()
Posted: Thu Oct 19, 2023 9:51 am
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).
Re: positionless player.play_sound()
Posted: Thu Oct 19, 2023 10:42 am
by Stringweasel
That would be awesome! It's been requested here as well by me
98618
Re: positionless player.play_sound()
Posted: Sat Oct 21, 2023 12:04 pm
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
Re: positionless player.play_sound()
Posted: Wed Nov 01, 2023 7:13 pm
by Donion
Decision was made to leave it as is for 1.1, so stay tuned for 2.0.