Fixed infinite loop errors

This commit is contained in:
WBHarry 2025-11-08 14:30:15 +01:00
parent 3af90dc0f1
commit a7d035bcdb
3 changed files with 24 additions and 24 deletions

View file

@ -166,26 +166,26 @@ export const healingTypes = {
export const defeatedConditions = () => { export const defeatedConditions = () => {
const defeated = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated; const defeated = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated;
return { return Object.values(defeatedConditionChoices).map(x => ({
defeated: { ...x,
id: 'defeated', img: defeated[`${x.id}Icon`],
name: 'DAGGERHEART.CONFIG.Condition.defeated.name', description: `DAGGERHEART.CONFIG.Condition.${x.id}.description`
img: defeated.defeatedIcon, }));
description: 'DAGGERHEART.CONFIG.Condition.defeated.description' };
},
unconscious: { const defeatedConditionChoices = {
id: 'unconscious', defeated: {
name: 'DAGGERHEART.CONFIG.Condition.unconscious.name', id: 'defeated',
img: defeated.unconsciousIcon, name: 'DAGGERHEART.CONFIG.Condition.defeated.name'
description: 'DAGGERHEART.CONFIG.Condition.unconscious.description' },
}, unconscious: {
dead: { id: 'unconscious',
id: 'dead', name: 'DAGGERHEART.CONFIG.Condition.unconscious.name'
name: 'DAGGERHEART.CONFIG.Condition.dead.name', },
img: defeated.deadIcon, dead: {
description: 'DAGGERHEART.CONFIG.Condition.dead.description' id: 'dead',
} name: 'DAGGERHEART.CONFIG.Condition.dead.name'
}; }
}; };
export const conditions = () => ({ export const conditions = () => ({

View file

@ -68,19 +68,19 @@ export default class DhAutomation extends foundry.abstract.DataModel {
}), }),
characterDefault: new fields.StringField({ characterDefault: new fields.StringField({
required: true, required: true,
choices: () => CONFIG.DH.GENERAL.defeatedConditions(), choices: CONFIG.DH.GENERAL.defeatedConditionChoices,
initial: 'unconscious', initial: 'unconscious',
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.characterDefault.label' label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.characterDefault.label'
}), }),
adversaryDefault: new fields.StringField({ adversaryDefault: new fields.StringField({
required: true, required: true,
choices: () => CONFIG.DH.GENERAL.defeatedConditions(), choices: CONFIG.DH.GENERAL.defeatedConditionChoices,
initial: 'defeated', initial: 'defeated',
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.adversaryDefault.label' label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.adversaryDefault.label'
}), }),
companionDefault: new fields.StringField({ companionDefault: new fields.StringField({
required: true, required: true,
choices: () => CONFIG.DH.GENERAL.defeatedConditions(), choices: CONFIG.DH.GENERAL.defeatedConditionChoices,
initial: 'defeated', initial: 'defeated',
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.companionDefault.label' label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.companionDefault.label'
}), }),

View file

@ -1,6 +1,6 @@
export async function runMigrations() { export async function runMigrations() {
let lastMigrationVersion = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LastMigrationVersion); let lastMigrationVersion = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LastMigrationVersion);
if (!lastMigrationVersion) lastMigrationVersion = '1.0.6'; if (!lastMigrationVersion) lastMigrationVersion = game.system.version;
if (foundry.utils.isNewerVersion('1.1.0', lastMigrationVersion)) { if (foundry.utils.isNewerVersion('1.1.0', lastMigrationVersion)) {
const lockedPacks = []; const lockedPacks = [];