Skip to content

Commit

Permalink
Group cooldown fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jg committed May 25, 2017
1 parent 0722625 commit ab3a817
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/interactive/cooldowns.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit ab3a817

Please sign in to comment.