Move attack type fix to actor migratedata

This commit is contained in:
Dapoolp 2025-08-15 13:19:11 +02:00
parent 2ef36401d5
commit fc8c6513dd
2 changed files with 8 additions and 1 deletions

View file

@ -82,7 +82,6 @@ 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;
}

View file

@ -25,6 +25,14 @@ export default class DhpActor extends Actor {
/* -------------------------------------------- */
/** @inheritDoc */
static migrateData(source) {
if(source.system?.attack && !source.system.attack.type) source.system.attack.type = "attack";
return super.migrateData(source);
}
/* -------------------------------------------- */
/**@inheritdoc */
static getDefaultArtwork(actorData) {
const { type } = actorData;