This commit is contained in:
2025-09-18 10:43:10 +02:00
parent 5186b26408
commit ddae4ad4b0
2 changed files with 17 additions and 13 deletions
+12 -11
View File
@@ -95,6 +95,7 @@ try {
data.rtRawString = "{}"; data.rtRawString = "{}";
} }
// expose a minimal config (labels) // expose a minimal config (labels)
data.cfg = { data.cfg = {
labels: { labels: {
@@ -145,17 +146,17 @@ try {
callback: async (html) => { callback: async (html) => {
const form = html[0].querySelector("form") || html[0]; const form = html[0].querySelector("form") || html[0];
const get = (k) => Number(form.querySelector(`[name="${k}"]`)?.value || 0); const get = (k) => Number(form.querySelector(`[name="${k}"]`)?.value || 0);
const patch = { const patchBase = {
"base.armour": get("armour"), armour: get("armour"),
"base.integrity": get("integrity"), integrity: get("integrity"),
"base.manoeuvre": get("manoeuvre"), manoeuvre: get("manoeuvre"),
"base.detection": get("detection"), detection: get("detection"),
"base.speed": get("speed"), speed: get("speed"),
"base.space": get("space"), space: get("space"),
"base.power": get("power") power: get("power")
}; };
for (const [k, v] of Object.entries(patch)) await this.actor.setFlag(VB_MOD, k, v); await this.actor.setFlag(VB_MOD, "base", patchBase);
this.render(true); this.render(true);
} }
}, },
cancel: { label: "Cancel" } cancel: { label: "Cancel" }
+5 -2
View File
@@ -1,10 +1,13 @@
Hooks.once('init', () => { Hooks.once('init', async () => {
try { try {
if (typeof Handlebars?.registerHelper === "function") { if (typeof Handlebars?.registerHelper === "function") {
Handlebars.registerHelper("json", (ctx) => JSON.stringify(ctx ?? {}, null, 2)); Handlebars.registerHelper("json", (ctx) => JSON.stringify(ctx ?? {}, null, 2));
} }
await loadTemplates([
"modules/wg-voidships-builder/templates/voidship-sheet.hbs"
]);
} catch (e) { } catch (e) {
console.warn("wg-voidships-builder: handlebars helper failed", e); console.warn("wg-voidships-builder: init failed", e);
} }
}); });