Improved the config app for Downtime activities. You can now create/edit/remove actions on them

This commit is contained in:
WBHarry 2025-07-21 21:04:34 +02:00
parent 42a705a870
commit c3d71f0c39
18 changed files with 275 additions and 196 deletions

View file

@ -112,7 +112,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
prepareData() {}
get index() {
return foundry.utils.getProperty(this.parent, this.systemPath).indexOf(this);
return foundry.utils.getProperty(this.parent, this.systemPath).findIndex(x => x.id === this.id);
}
get id() {

View file

@ -1,4 +1,5 @@
import { defaultRestOptions } from '../../config/generalConfig.mjs';
import ActionField from '../fields/actionField.mjs';
export default class DhHomebrew extends foundry.abstract.DataModel {
static LOCALIZATION_PREFIXES = ['DAGGERHEART.SETTINGS.Homebrew']; // Doesn't work for some reason
@ -61,7 +62,7 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
base64: false
}),
description: new fields.HTMLField(),
actions: new fields.ArrayField(new fields.ObjectField())
actions: new fields.ArrayField(new ActionField())
}),
{ initial: defaultRestOptions.longRest() }
)
@ -78,7 +79,7 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
base64: false
}),
description: new fields.HTMLField(),
actions: new fields.ArrayField(new fields.ObjectField())
actions: new fields.ArrayField(new ActionField())
}),
{ initial: defaultRestOptions.shortRest() }
)