Begin working on the migration script upon world load for Actors

This commit is contained in:
Oliver 2026-04-19 23:41:49 -06:00
parent 8f8da244c0
commit 14f76e0a27
6 changed files with 192 additions and 1 deletions

View file

@ -1,7 +1,7 @@
import { __ID__ } from "../consts.mjs";
const { Actor } = foundry.documents;
const { hasProperty } = foundry.utils;
const { hasProperty, setProperty } = foundry.utils;
export class TAFActor extends Actor {
@ -33,6 +33,12 @@ export class TAFActor extends Actor {
super._onEmbeddedDocumentChange(...args);
this.#sortedTypes = null;
};
static migrateData(data, ...args) {
if (Object.keys(data.system?.attr ?? {}).length > 0) {
setProperty(data, `flags.${__ID__}.convertAttributesIntoItems`, true);
};
};
// #endregion Lifecycle
// #region Token Attributes