mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 04:15:14 -04:00
audio: check attenuation distance before playing/loading
* This fixes a lot of issues with sound spamming (e.g. on Cuberite servers)
This commit is contained in:
parent
668e3d27dc
commit
c5dfb63113
@ -184,6 +184,12 @@ class AudioPlayer(
|
|||||||
if (!profile.enabled) {
|
if (!profile.enabled) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
position?.let {
|
||||||
|
val distance = (this.listener.position - it).length()
|
||||||
|
if (distance >= sound.attenuationDistance) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
queue += add@{
|
queue += add@{
|
||||||
sound.load(connection.assetsManager)
|
sound.load(connection.assetsManager)
|
||||||
val source = getAvailableSource()
|
val source = getAvailableSource()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user