audio: don't play sound if muted

This commit is contained in:
Moritz Zwerger 2024-06-24 23:15:11 +02:00
parent 6f2153cba3
commit 6a4771bd47
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 3 additions and 2 deletions

View File

@ -45,6 +45,7 @@ object FileUtil {
return readFile(path.toFile(), compressed)
}
@Deprecated("kutil 1.26.3")
fun File.mkdirParent() {
val parent = this.parentFile
if (parent.exists()) {

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
* Copyright (C) 2020-2024 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -193,7 +193,7 @@ class AudioPlayer(
}
private fun playSound(sound: Sound, position: Vec3d? = null, volume: Float = 1.0f, pitch: Float = 1.0f) {
if (!profile.enabled) {
if (!profile.enabled || profile.volume.master <= 0.0f) {
return
}
position?.let { if (!shouldPlay(sound, position)) return }