mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 06:26:13 +01:00
[Feature] 1543 - SceneEnvironment Trigger Registration (#1564)
* Added trigger Registration/Unregistration for scene environments * Fixed so that saving throw damage mitigation works again (#1555) * . (#1563) * Fixed DowntimeMoves and ItemFeatures reset functions (#1568) * Fixed an error where a player having their token initially selected caused an error in effectsDisplay.mjs (#1569) * [Fix] Damage Rerolls (#1566) * Fixed so that damage rerolls work again * Set default data for a roll instead and fix title (#1570) * Set default data for a roll instead and fix title * Ensure same options object is used --------- Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com> * Fixed when users drag in compendium environments to the sceneEnvironments (#1573) * . --------- Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com>
This commit is contained in:
parent
0d84516813
commit
bdb8997324
2 changed files with 44 additions and 11 deletions
|
|
@ -51,6 +51,27 @@ export default class DhScene extends Scene {
|
|||
}
|
||||
}
|
||||
|
||||
async _preUpdate(changes, options, user) {
|
||||
const allowed = await super._preUpdate(changes, options, user);
|
||||
if (allowed === false) return false;
|
||||
|
||||
if (changes.flags?.daggerheart) {
|
||||
if (this._source.flags.daggerheart) {
|
||||
const unregisterTriggerData = this._source.flags.daggerheart.sceneEnvironments.reduce(
|
||||
(acc, env) => {
|
||||
if (!changes.flags.daggerheart.sceneEnvironments.includes(env)) acc.sceneEnvironments.push(env);
|
||||
|
||||
return acc;
|
||||
},
|
||||
{ ...this._source.flags.daggerheart, sceneEnvironments: [] }
|
||||
);
|
||||
game.system.registeredTriggers.unregisterSceneEnvironmentTriggers(unregisterTriggerData);
|
||||
}
|
||||
|
||||
game.system.registeredTriggers.registerSceneEnvironmentTriggers(changes.flags.daggerheart);
|
||||
}
|
||||
}
|
||||
|
||||
_onDelete(options, userId) {
|
||||
super._onDelete(options, userId);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue