Added some safety for missing things if someone was on a REALLY old system version and then updated all the way

This commit is contained in:
WBHarry 2026-06-27 21:12:12 +02:00
parent 453054c0e4
commit f47ec012ea

View file

@ -155,6 +155,7 @@ export async function runMigrations() {
/* Migrate old countdown structure */
const countdownSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
if (!countdownSettings.narrative || !countdownSettings.encounter) {
const getCountdowns = (data, type) => {
return Object.keys(data.countdowns).reduce((acc, key) => {
const countdown = data.countdowns[key];
@ -189,11 +190,13 @@ export async function runMigrations() {
data: { refreshType: RefreshType.Countdown }
});
Hooks.callAll(socketEvent.Refresh, { refreshType: RefreshType.Countdown });
}
lastMigrationVersion = '1.2.0';
}
if (foundry.utils.isNewerVersion('1.2.7', lastMigrationVersion)) {
try {
const tagTeam = game.settings.get(CONFIG.DH.id, 'TagTeamRoll');
const initatorMissing = tagTeam.initiator && !game.actors.some(actor => actor.id === tagTeam.initiator);
const missingMembers = Object.keys(tagTeam.members).reduce((acc, id) => {
@ -208,9 +211,10 @@ export async function runMigrations() {
members: missingMembers
});
await game.settings.set(CONFIG.DH.id, 'TagTeamRoll', tagTeam);
} finally {
lastMigrationVersion = '1.2.7';
}
}
if (foundry.utils.isNewerVersion('1.5.5', lastMigrationVersion)) {
/* Clear out Environments that were added directly from compendium */