mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-11 11:35:59 +01:00
Fixed downtime config again
This commit is contained in:
parent
20dbd3804c
commit
b8786d981e
8 changed files with 105 additions and 45 deletions
|
|
@ -202,11 +202,21 @@ export function ActionMixin(Base) {
|
|||
}
|
||||
|
||||
async update(updates, options = {}) {
|
||||
const path = this.inCollection ? `system.${this.systemPath}.${this.id}` : `system.${this.systemPath}`,
|
||||
const isSetting = !this.parent.parent;
|
||||
const basePath = isSetting ? this.systemPath : `system.${this.systemPath}`;
|
||||
|
||||
const path = this.inCollection ? `${basePath}.${this.id}` : basePath;
|
||||
|
||||
let result = null;
|
||||
if (isSetting) {
|
||||
await this.parent.updateSource({ [path]: updates }, options);
|
||||
result = this.parent;
|
||||
} else {
|
||||
result = await this.item.update({ [path]: updates }, options);
|
||||
}
|
||||
return this.inCollection
|
||||
? foundry.utils.getProperty(result, `system.${this.systemPath}`).get(this.id)
|
||||
: foundry.utils.getProperty(result, `system.${this.systemPath}`);
|
||||
? foundry.utils.getProperty(result, basePath).get(this.id)
|
||||
: foundry.utils.getProperty(result, basePath);
|
||||
}
|
||||
|
||||
delete() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { defaultRestOptions } from '../../config/generalConfig.mjs';
|
||||
import ActionField from '../fields/actionField.mjs';
|
||||
import { ActionsField } from '../fields/actionField.mjs';
|
||||
|
||||
export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||
static LOCALIZATION_PREFIXES = ['DAGGERHEART.SETTINGS.Homebrew']; // Doesn't work for some reason
|
||||
|
|
@ -62,7 +62,7 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
|||
base64: false
|
||||
}),
|
||||
description: new fields.HTMLField(),
|
||||
actions: new fields.ArrayField(new ActionField())
|
||||
actions: new ActionsField()
|
||||
}),
|
||||
{ initial: defaultRestOptions.longRest() }
|
||||
)
|
||||
|
|
@ -79,7 +79,7 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
|||
base64: false
|
||||
}),
|
||||
description: new fields.HTMLField(),
|
||||
actions: new fields.ArrayField(new ActionField())
|
||||
actions: new ActionsField()
|
||||
}),
|
||||
{ initial: defaultRestOptions.shortRest() }
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue