Create the Item data model

This commit is contained in:
Oliver 2026-03-08 13:11:14 -06:00
parent cc8f054115
commit f91c3d2419
5 changed files with 38 additions and 13 deletions

View file

@ -0,0 +1,25 @@
export class GenericItemData extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields;
return {
weight: new fields.NumberField({
min: 0,
initial: 0,
nullable: false,
}),
quantity: new fields.NumberField({
integer: true,
min: 0,
initial: 1,
}),
equipped: new fields.BooleanField({
initial: true,
}),
description: new fields.HTMLField({
blank: true,
trim: true,
initial: ``,
}),
};
};
};

View file

@ -1,7 +0,0 @@
const { Item } = foundry.documents;
export class TAFItem extends Item {
async _preCreate() {
return false;
};
};

View file

@ -5,11 +5,11 @@ import { SingleModePlayerSheet } from "../apps/SingleModePlayerSheet.mjs";
// Data Models
import { PlayerData } from "../data/Player.mjs";
import { GenericItemData } from "../data/Item/generic.mjs";
// Documents
import { TAFActor } from "../documents/Actor.mjs";
import { TAFCombatant } from "../documents/Combatant.mjs";
import { TAFItem } from "../documents/Item.mjs";
import { TAFTokenDocument } from "../documents/Token.mjs";
// Settings
@ -30,10 +30,7 @@ Hooks.on(`init`, () => {
CONFIG.Combatant.documentClass = TAFCombatant;
CONFIG.Actor.dataModels.player = PlayerData;
// We disable items in the system for now
CONFIG.Item.documentClass = TAFItem;
delete CONFIG.ui.sidebar.TABS.items;
CONFIG.Item.dataModels.generic = GenericItemData;
foundry.documents.collections.Actors.registerSheet(
__ID__,