Better handling of active door instances
This commit is contained in:
parent
19e70d1c78
commit
509831cc0c
|
@ -84,6 +84,22 @@ exports.getModule = class AbracadabraModule extends MenuModule {
|
||||||
* Font support ala all other menus... or does this just work?
|
* Font support ala all other menus... or does this just work?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
incrementActiveDoorNodeInstances() {
|
||||||
|
if(activeDoorNodeInstances[this.config.name]) {
|
||||||
|
activeDoorNodeInstances[this.config.name] += 1;
|
||||||
|
} else {
|
||||||
|
activeDoorNodeInstances[this.config.name] = 1;
|
||||||
|
}
|
||||||
|
this.activeDoorInstancesIncremented = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
decrementActiveDoorNodeInstances() {
|
||||||
|
if(true === this.activeDoorInstancesIncremented) {
|
||||||
|
activeDoorNodeInstances[this.config.name] -= 1;
|
||||||
|
this.activeDoorInstancesIncremented = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
initSequence() {
|
initSequence() {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
|
@ -116,14 +132,8 @@ exports.getModule = class AbracadabraModule extends MenuModule {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// :TODO: JS elegant way to do this?
|
self.incrementActiveDoorNodeInstances();
|
||||||
if(activeDoorNodeInstances[self.config.name]) {
|
return callback(null);
|
||||||
activeDoorNodeInstances[self.config.name] += 1;
|
|
||||||
} else {
|
|
||||||
activeDoorNodeInstances[self.config.name] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
callback(null);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function prepareDoor(callback) {
|
function prepareDoor(callback) {
|
||||||
|
@ -169,6 +179,7 @@ exports.getModule = class AbracadabraModule extends MenuModule {
|
||||||
|
|
||||||
this.doorInstance.run(exeInfo, () => {
|
this.doorInstance.run(exeInfo, () => {
|
||||||
trackDoorRunEnd(doorTracking);
|
trackDoorRunEnd(doorTracking);
|
||||||
|
this.decrementActiveDoorNodeInstances();
|
||||||
|
|
||||||
// client may have disconnected while process was active -
|
// client may have disconnected while process was active -
|
||||||
// we're done here if so.
|
// we're done here if so.
|
||||||
|
@ -194,9 +205,7 @@ exports.getModule = class AbracadabraModule extends MenuModule {
|
||||||
|
|
||||||
leave() {
|
leave() {
|
||||||
super.leave();
|
super.leave();
|
||||||
if(!this.lastError) {
|
this.decrementActiveDoorNodeInstances();
|
||||||
activeDoorNodeInstances[this.config.name] -= 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
finishedLoading() {
|
finishedLoading() {
|
||||||
|
|
Loading…
Reference in New Issue