From c6ec60b5bff600d2992bccff3271526486647241 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 13 Mar 2026 21:45:13 -0600 Subject: [PATCH] Update the Player data model and move it into an Actor folder since we now have an item data model --- module/data/{Player.mjs => Actor/player.mjs} | 5 +++++ module/documents/Actor.mjs | 9 ++++++++- module/hooks/init.mjs | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) rename module/data/{Player.mjs => Actor/player.mjs} (89%) diff --git a/module/data/Player.mjs b/module/data/Actor/player.mjs similarity index 89% rename from module/data/Player.mjs rename to module/data/Actor/player.mjs index b2ad529..d0e8dbc 100644 --- a/module/data/Player.mjs +++ b/module/data/Actor/player.mjs @@ -7,6 +7,11 @@ export class PlayerData extends foundry.abstract.TypeDataModel { trim: true, initial: ``, }), + carryCapacity: new fields.NumberField({ + min: 0, + nullable: true, + initial: null, + }), attr: new fields.TypedObjectField( new fields.SchemaField({ name: new fields.StringField({ blank: false, trim: true }), diff --git a/module/documents/Actor.mjs b/module/documents/Actor.mjs index 91c2bfa..c142baa 100644 --- a/module/documents/Actor.mjs +++ b/module/documents/Actor.mjs @@ -42,7 +42,14 @@ export class TAFActor extends Actor { }; getRollData() { - const data = {}; + /* + All properties assigned during this phase of the roll data prep can potentially + be overridden by users creating attributes of the same key, if users shouldn't + be able to override, assign the property before the return of this function. + */ + const data = { + carryCapacity: this.system.carryCapacity ?? null, + }; if (`attr` in this.system) { for (const attrID in this.system.attr) { diff --git a/module/hooks/init.mjs b/module/hooks/init.mjs index bcf540e..0fd7c19 100644 --- a/module/hooks/init.mjs +++ b/module/hooks/init.mjs @@ -5,7 +5,7 @@ import { SingleModePlayerSheet } from "../apps/SingleModePlayerSheet.mjs"; import { GenericItemSheet } from "../apps/GenericItemSheet.mjs"; // Data Models -import { PlayerData } from "../data/Player.mjs"; +import { PlayerData } from "../data/Actor/player.mjs"; import { GenericItemData } from "../data/Item/generic.mjs"; // Documents