Datamodel + Appv2 migration, WIP

This commit is contained in:
2026-01-13 08:09:11 +01:00
parent 93d35abde2
commit 364278527d
143 changed files with 3712 additions and 708 deletions

View File

@@ -5,7 +5,7 @@ import { BoLActorSheet } from "./actor/actor-sheet.js"
import { BoLVehicleSheet } from "./actor/vehicle-sheet.js"
import { BoLHordeSheet } from "./actor/horde-sheet.js"
import { BoLItem } from "./item/item.js"
import { BoLItemSheet } from "./item/item-sheet.js"
// Note: Old BoLItemSheet (AppV1) is now replaced by AppV2 sheets
import { System, BOL } from "./system/config.js"
import { preloadHandlebarsTemplates } from "./system/templates.js"
import { registerHandlebarsHelpers } from "./system/helpers.js"
@@ -21,6 +21,9 @@ import { BoLRoll } from "./controllers/bol-rolls.js"
// Import DataModels
import * as models from "./models/_module.mjs"
// Import AppV2 Sheets
import * as sheets from "./applications/sheets/_module.mjs"
/* -------------------------------------------- */
Hooks.once('init', async function () {
@@ -32,7 +35,8 @@ Hooks.once('init', async function () {
BoLUtility,
macros: Macros,
config: BOL,
models
models,
sheets
};
// Game socket
@@ -57,13 +61,13 @@ Hooks.once('init', async function () {
horde: models.BoLHorde,
vehicle: models.BoLVehicle
}
CONFIG.Item.documentClass = BoLItem;
CONFIG.Item.dataModels = {
item: models.BoLItem,
feature: models.BoLFeature
}
CONFIG.Combat.documentClass = BoLCombatManager;
// Register sheet application classes
@@ -72,8 +76,17 @@ Hooks.once('init', async function () {
foundry.documents.collections.Actors.registerSheet("bol", BoLVehicleSheet, { types: ["vehicle"], makeDefault: true })
foundry.documents.collections.Actors.registerSheet("bol", BoLHordeSheet, { types: ["horde"], makeDefault: true })
// Register AppV2 Item Sheets
foundry.documents.collections.Items.unregisterSheet("core", foundry.appv1.sheets.ItemSheet);
foundry.documents.collections.Items.registerSheet("bol", BoLItemSheet, { makeDefault: true });
foundry.documents.collections.Items.registerSheet("bol", sheets.BoLItemSheet, { types: ["item"], makeDefault: true });
foundry.documents.collections.Items.registerSheet("bol", sheets.BoLFeatureSheet, { types: ["feature"], makeDefault: true });
// Debug: Verify AppV2 sheets are loaded
console.log("BoL Item Sheets registered:", {
BoLItemSheet: sheets.BoLItemSheet.name,
BoLFeatureSheet: sheets.BoLFeatureSheet.name,
extendsApplicationV2: sheets.BoLItemSheet.prototype instanceof foundry.applications.api.ApplicationV2
});
// Inot useful stuff
BoLUtility.init()