Create the Item data model
This commit is contained in:
parent
cc8f054115
commit
f91c3d2419
5 changed files with 38 additions and 13 deletions
|
|
@ -2,6 +2,9 @@
|
|||
"TYPES": {
|
||||
"Actor": {
|
||||
"player": "Player"
|
||||
},
|
||||
"Item": {
|
||||
"generic": "Generic Item"
|
||||
}
|
||||
},
|
||||
"taf": {
|
||||
|
|
|
|||
25
module/data/Item/generic.mjs
Normal file
25
module/data/Item/generic.mjs
Normal 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: ``,
|
||||
}),
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
const { Item } = foundry.documents;
|
||||
|
||||
export class TAFItem extends Item {
|
||||
async _preCreate() {
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
|
@ -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__,
|
||||
|
|
|
|||
|
|
@ -39,7 +39,14 @@
|
|||
"filePathFields": {}
|
||||
}
|
||||
},
|
||||
"Item": {}
|
||||
"Item": {
|
||||
"generic": {
|
||||
"htmlFields": [
|
||||
"description"
|
||||
],
|
||||
"filePathFields": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"socket": true,
|
||||
"flags": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue