Add toolip and trait descriptions

This commit is contained in:
2026-04-24 19:02:08 +02:00
parent 999b78c6fc
commit b19ba64a39
8 changed files with 89 additions and 6 deletions
+16 -1
View File
@@ -7,10 +7,21 @@ import * as applications from "./module/applications/_module.mjs"
import { SystemManager } from "./module/applications/hud/system-manager.js"
import { MODULE, REQUIRED_CORE_MODULE_VERSION } from "./module/applications/hud/constants.js"
Hooks.once("init", function () {
Hooks.once("init", async function () {
console.info("Adventures with Emmy | Initializing System")
console.info(SYSTEM.ASCII)
// Load trait tooltip descriptions from external JSON
try {
const resp = await fetch("systems/fvtt-adventures-with-emmy/module/config/trait-descriptions.json")
const data = await resp.json()
// Strip the comment key and populate SYSTEM.TRAIT_DESCRIPTIONS in-place
delete data["_comment"]
Object.assign(SYSTEM.TRAIT_DESCRIPTIONS, data)
} catch (err) {
console.warn("Adventures with Emmy | Failed to load trait-descriptions.json", err)
}
globalThis.adventuresWithEmmy = game.system
game.system.CONST = SYSTEM
@@ -83,6 +94,10 @@ Hooks.once("init", function () {
// Handlebars helpers
Handlebars.registerHelper("abs", (value) => Math.abs(value ?? 0))
Handlebars.registerHelper("traitTooltip", (traitName) => {
const key = (traitName ?? "").toLowerCase()
return SYSTEM.TRAIT_DESCRIPTIONS[key] ?? ""
})
})
Hooks.once("ready", function () {