Prevent new scripts from interrupting scripts in progress

This commit is contained in:
Jeff Parsons 2017-02-08 09:25:09 -08:00 • committed by Jeff Parsons
commit d23ae82679
13 changed files with 1864 additions and 1423 deletions

View file

@ -113,11 +113,12 @@ function addStickyMachine(idMachine, sPosition)
*/
function commandMachine(control, fSingle, idMachine, sComponent, sCommand, sValue)
{
if (fSingle) {
control.disabled = true;
}
if (sCommand == "script" && window.processMachineScript) {
return window.processMachineScript(idMachine, sComponent, sValue);
if (window.processMachineScript(idMachine, sValue)) {
if (fSingle) control.disabled = true;
return true;
}
return false;
}
if (sComponent && window.findMachineComponent) {
var component = window.findMachineComponent(idMachine, sComponent);
@ -127,7 +128,11 @@ function commandMachine(control, fSingle, idMachine, sComponent, sCommand, sValu
var fnCommand = exports[sCommand];
if (fnCommand) {
//noinspection JSUnresolvedFunction
return !!fnCommand.call(component, sValue);
if (fnCommand.call(component, sValue)) {
if (fSingle) control.disabled = true;
return true;
}
return false;
}
}
}