From cdbec62924f913b04709a26cf458d905a1237028 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Tue, 4 Apr 2023 13:00:40 +0200 Subject: [PATCH] adding option to disable sounds --- src/core/Global.ttslua | 5 +++++ src/core/SoundCubeApi.ttslua | 8 +++++++- xml/OptionPanel.xml | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index e27ea4db..71cf63bf 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -843,6 +843,10 @@ function applyOptionPanelChange(id, state) elseif id == "showTitleSplash" then optionPanel[id] = state + -- option: Disable sound effects + elseif id == "disableSoundEffects" then + optionPanel[id] = state + -- option: Show token arranger elseif id == "showTokenArranger" then optionPanel[id] = spawnOrRemoveHelper(state, "Token Arranger", {-42.3, 1.6, -46.5}) @@ -981,6 +985,7 @@ function onClick_defaultSettings() -- clean reset of variable optionPanel = { + disableSoundEffects = false, playAreaSnapTags = true, showAttachmentHelper = false, showCleanUpHelper = false, diff --git a/src/core/SoundCubeApi.ttslua b/src/core/SoundCubeApi.ttslua index 06273524..4133b190 100644 --- a/src/core/SoundCubeApi.ttslua +++ b/src/core/SoundCubeApi.ttslua @@ -7,10 +7,16 @@ do ["Deep Bell"] = 1 } + function playTriggerEffect(index) + if Global.getTable("optionPanel").disableSoundEffects ~= true then + getObjectsWithTag("SoundCube")[1].AssetBundle.playTriggerEffect(index) + end + end + -- plays the by name requested sound ---@param soundName String Name of the sound to play SoundCubeApi.playSoundByName = function(soundName) - getObjectsWithTag("SoundCube")[1].AssetBundle.playTriggerEffect(soundIndices[soundName]) + playTriggerEffect(soundIndices[soundName]) end return SoundCubeApi diff --git a/xml/OptionPanel.xml b/xml/OptionPanel.xml index 267fb8b4..2ce05cc1 100644 --- a/xml/OptionPanel.xml +++ b/xml/OptionPanel.xml @@ -129,6 +129,20 @@ + + + + + Disable sound effects + This disables additional soundeffects, e.g. on scenario placement. + + + + + + +