diff --git a/module/actor.js b/module/actor.js index 2ecae44a..5ee13feb 100644 --- a/module/actor.js +++ b/module/actor.js @@ -112,6 +112,16 @@ export class RdDActor extends Actor { if (actorData.type === 'vehicule') this._prepareVehiculeData(actorData); } + /* -------------------------------------------- */ + setRollWindowsOpened( flag ) { + this.rollWindowsOpened = flag; + } + + /* -------------------------------------------- */ + isRollWindowsOpened( ) { + return this.rollWindowsOpened; + } + /* -------------------------------------------- */ _prepareCreatureData(actorData) { this.computeEncombrementTotalEtMalusArmure(); diff --git a/module/rdd-roll.js b/module/rdd-roll.js index aff36f6b..079fc277 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -18,6 +18,12 @@ export class RdDRoll extends Dialog { /* -------------------------------------------- */ static async create(actor, rollData, dialogConfig, ...actions) { + if (actor.isRollWindowsOpened() ) { + ui.notifications.warn("Vous avez déja une fenêtre de Test ouverte, il faut la fermer avant d'en ouvrir une autre.") + return; + } + actor.setRollWindowsOpened(true); + RdDRoll._ensureCorrectActions(actions); RdDRoll._setDefaultOptions(actor, rollData); @@ -102,6 +108,7 @@ export class RdDRoll extends Dialog { close() { if (this.rollData.canClose) { + this.actor.setRollWindowsOpened(false); return super.close(); } ui.notifications.info("Vous devez faire ce jet de dés!"); @@ -112,7 +119,8 @@ export class RdDRoll extends Dialog { async onAction(action, html) { await RdDResolutionTable.rollData(this.rollData); console.log("RdDRoll -=>", this.rollData, this.rollData.rolled); - + this.actor.setRollWindowsOpened(false); + if (action.callbacks) for (let callback of action.callbacks) { if (callback.condition == undefined || callback.condition(this.rollData)) { diff --git a/system.json b/system.json index 871d9a2e..1e23b4f2 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "Rêve de Dragon RPG for FoundryVTT", - "version": "1.3.23", + "version": "1.3.24", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.7.5", "compatibleCoreVersion": "0.7.9",