From 89d66c1347a74c34765c0c39c22b068b80eb8582 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Fri, 26 Feb 2021 23:54:17 +0100 Subject: [PATCH] =?UTF-8?q?#164=20:=20une=20seule=20fen=C3=AAtre=20de=20je?= =?UTF-8?q?t=20autoris=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 10 ++++++++++ module/rdd-roll.js | 10 +++++++++- system.json | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) 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",