Move missing attack type to getModel

This commit is contained in:
Dapoolp 2025-08-14 15:04:40 +02:00
parent 42aba217ee
commit 87236879a9
2 changed files with 2 additions and 2 deletions

View file

@ -29,7 +29,7 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
bonus: new fields.NumberField({ nullable: true, initial: null, label: 'Bonus' }),
custom: new fields.SchemaField({
enabled: new fields.BooleanField({ label: 'Custom Formula' }),
formula: new FormulaField({ label: 'Formula' })
formula: new FormulaField({ label: 'Formula', initial: "" })
})
};
}

View file

@ -82,6 +82,7 @@ export class ActionsField extends MappingField {
*/
export class ActionField extends foundry.data.fields.ObjectField {
getModel(value) {
if(value && !value.type) value.type = 'attack';
return (
game.system.api.models.actions.actionsTypes[value.type] ??
null
@ -102,7 +103,6 @@ export class ActionField extends foundry.data.fields.ObjectField {
/** @override */
initialize(value, model, options = {}) {
if(value && !value.type) value.type = 'attack';
const cls = this.getModel(value);
if (cls) return new cls(value, { parent: model, ...options });
return foundry.utils.deepClone(value);