Fixed when users drag in compendium environments to the sceneEnvironments (#1573)

This commit is contained in:
WBHarry 2026-01-23 11:51:14 +01:00 committed by GitHub
parent fa3b3fa0a8
commit 21ef288283
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 1 deletions

View file

@ -210,6 +210,22 @@ export async function runMigrations() {
lastMigrationVersion = '1.2.7';
}
if (foundry.utils.isNewerVersion('1.5.5', lastMigrationVersion)) {
for (const scene of game.scenes) {
if (!scene.flags.daggerheart) continue;
const systemData = new game.system.api.data.scenes.DHScene(scene.flags.daggerheart);
const sceneEnvironments = systemData.sceneEnvironments;
const newEnvironments = sceneEnvironments.filter(x => !x?.pack);
if (newEnvironments.length !== sceneEnvironments.length)
await scene.update({ 'flags.daggerheart.sceneEnvironments': newEnvironments });
}
ui.nav.render(true);
lastMigrationVersion = '1.5.5';
}
//#endregion
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LastMigrationVersion, lastMigrationVersion);