feat: allow selecting all resources in the combat tracker config and the default token config
This commit is contained in:
parent
11dc6fc423
commit
1a27fa7e97
2 changed files with 32 additions and 0 deletions
30
src/token-document.ts
Normal file
30
src/token-document.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { DS4Actor } from "./actor/actor";
|
||||
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 DS4Actor({ 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue