Update the Player data model and move it into an Actor folder since we now have an item data model

This commit is contained in:
Oliver 2026-03-13 21:45:13 -06:00
parent d9d66abf27
commit c6ec60b5bf
3 changed files with 14 additions and 2 deletions

View file

@ -7,6 +7,11 @@ export class PlayerData extends foundry.abstract.TypeDataModel {
trim: true, trim: true,
initial: ``, initial: ``,
}), }),
carryCapacity: new fields.NumberField({
min: 0,
nullable: true,
initial: null,
}),
attr: new fields.TypedObjectField( attr: new fields.TypedObjectField(
new fields.SchemaField({ new fields.SchemaField({
name: new fields.StringField({ blank: false, trim: true }), name: new fields.StringField({ blank: false, trim: true }),

View file

@ -42,7 +42,14 @@ export class TAFActor extends Actor {
}; };
getRollData() { 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) { if (`attr` in this.system) {
for (const attrID in this.system.attr) { for (const attrID in this.system.attr) {

View file

@ -5,7 +5,7 @@ import { SingleModePlayerSheet } from "../apps/SingleModePlayerSheet.mjs";
import { GenericItemSheet } from "../apps/GenericItemSheet.mjs"; import { GenericItemSheet } from "../apps/GenericItemSheet.mjs";
// Data Models // Data Models
import { PlayerData } from "../data/Player.mjs"; import { PlayerData } from "../data/Actor/player.mjs";
import { GenericItemData } from "../data/Item/generic.mjs"; import { GenericItemData } from "../data/Item/generic.mjs";
// Documents // Documents