[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:
WBHarry 2026-01-24 11:15:07 +01:00 committed by GitHub
parent 0d84516813
commit bdb8997324
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 44 additions and 11 deletions

View file

@ -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);