// SPDX-FileCopyrightText: 2021 Johannes Loher // // SPDX-License-Identifier: MIT import { DS4ActorProxy } from "./actor/proxy"; import { getGame } from "./helpers"; let fallbackData: foundry.data.ActorData["data"] | undefined = undefined; function getFallbackData() { if (!fallbackData) { fallbackData = {} as foundry.data.ActorData["data"]; for (const type of getGame().system.template.Actor?.types ?? []) { foundry.utils.mergeObject( fallbackData, new DS4ActorProxy({ type: type as foundry.data.ActorData["type"], name: "temporary" }).data.data, ); } } return fallbackData; } export class DS4TokenDocument extends TokenDocument { static getTrackedAttributes(data?: foundry.data.ActorData["data"], _path: string[] = []) { if (!data) { data = getFallbackData(); } return super.getTrackedAttributes(data, _path); } }