diff --git a/lib/interactive/cooldowns.js b/lib/interactive/cooldowns.js index 5e8fc4d37..07b2495b3 100644 --- a/lib/interactive/cooldowns.js +++ b/lib/interactive/cooldowns.js @@ -27,14 +27,22 @@ function cooldownRouter(mixerControls, mixerControl, firebot, control){ // Group Cooldown // Buttons should be an array of controlIDs that should be cooled down. function groupCooldown(buttons, cooldown, mixerControls){ - for (button of buttons){ - // Look through mixerControls to find matching button... - for (control of mixerControls){ - var controlID = control.controlID; + + var buttonArray = buttons; + + for (var i = buttonArray.length - 1; i >= 0; i--) { + var button = buttonArray[i]; + for (mixerControl of mixerControls){ + var controlID = mixerControl.controlID; // This is a matching control! Send cooldown. if (button == controlID){ - control.setCooldown(cooldown); + console.log(button, controlID); + console.log('-------'+controlID+' is cooling down. --------') + mixerControl.setCooldown(cooldown); + + // Remove from array. + buttonArray.splice(i, 1); } } }