Audio group chat cooldown bgm fixed.

This commit is contained in:
Tony Ribeiro 2023-08-23 05:49:24 +02:00
parent d070336e9c
commit ecb4436f07
1 changed files with 8 additions and 5 deletions

View File

@ -160,7 +160,7 @@ async function onBGMCooldownInput() {
extension_settings.audio.bgm_cooldown = ~~($("#audio_bgm_cooldown").val()); extension_settings.audio.bgm_cooldown = ~~($("#audio_bgm_cooldown").val());
cooldownBGM = extension_settings.audio.bgm_cooldown * 1000; cooldownBGM = extension_settings.audio.bgm_cooldown * 1000;
saveSettingsDebounced(); saveSettingsDebounced();
//console.debug(DEBUG_PREFIX,"UPDATED BGM cooldown to",extension_settings.audio.bgm_cooldown); console.debug(DEBUG_PREFIX,"UPDATED BGM cooldown to",extension_settings.audio.bgm_cooldown);
} }
$(document).ready(function () { $(document).ready(function () {
@ -301,6 +301,8 @@ async function moduleWorker() {
const moduleEnabled = extension_settings.audio.enabled; const moduleEnabled = extension_settings.audio.enabled;
if (moduleEnabled) { if (moduleEnabled) {
if(cooldownBGM > 0)
cooldownBGM -= UPDATE_INTERVAL; cooldownBGM -= UPDATE_INTERVAL;
if (fallback_BGMS == null){ if (fallback_BGMS == null){
@ -384,7 +386,7 @@ async function moduleWorker() {
cooldownBGM = extension_settings.audio.bgm_cooldown * 1000; cooldownBGM = extension_settings.audio.bgm_cooldown * 1000;
currentExpressionBGM = newExpression; currentExpressionBGM = newExpression;
console.debug(DEBUG_PREFIX,"(SOLO) Updated current character expression to",currentExpressionBGM); console.debug(DEBUG_PREFIX,"(SOLO) Updated current character expression to",currentExpressionBGM,"cooldown",cooldownBGM);
updateBGM(); updateBGM();
return; return;
} }
@ -414,11 +416,12 @@ async function moduleWorker() {
//console.debug(DEBUG_PREFIX,"(GROUP) BGM switch on cooldown:",cooldownBGM); //console.debug(DEBUG_PREFIX,"(GROUP) BGM switch on cooldown:",cooldownBGM);
return; return;
} }
cooldownBGM = extension_settings.audio.cooldownBGM;
cooldownBGM = extension_settings.audio.bgm_cooldown * 1000;
currentCharacterBGM = newCharacter; currentCharacterBGM = newCharacter;
currentExpressionBGM = FALLBACK_EXPRESSION; currentExpressionBGM = FALLBACK_EXPRESSION;
updateBGM(); updateBGM();
console.debug(DEBUG_PREFIX,"(GROUP) Updated current character BGM to",currentExpressionBGM); console.debug(DEBUG_PREFIX,"(GROUP) Updated current character BGM to",currentExpressionBGM,"cooldown",cooldownBGM);
return; return;
} }