v0.4.1 — fix scene-control button on Foundry v14 (tokens group + onChange)
The toolbar button was registered on the notes group with onClick, which v14 ignores, so no entry point appeared. Now mirrors the Zero Engine system's working pattern: token group, visible+button, onChange (v14) / array (v13). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"id": "sla-blueprint-news",
|
"id": "sla-blueprint-news",
|
||||||
"title": "SLA Blueprint News",
|
"title": "SLA Blueprint News",
|
||||||
"description": "Generate SLA Industries BPN mission briefings as journal entries — a player-facing Brief and a separate GM-only Dossier, in the SLA house style with procedural artwork. Engine-agnostic core; this module is the Foundry wrapper.",
|
"description": "Generate SLA Industries BPN mission briefings as journal entries — a player-facing Brief and a separate GM-only Dossier, in the SLA house style with procedural artwork. Engine-agnostic core; this module is the Foundry wrapper.",
|
||||||
"version": "0.4.0",
|
"version": "0.4.1",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "13",
|
"minimum": "13",
|
||||||
"verified": "14.361",
|
"verified": "14.361",
|
||||||
|
|||||||
+18
-13
@@ -33,27 +33,32 @@ Hooks.on("renderJournalDirectory", (_app, html) => {
|
|||||||
header.appendChild(btn);
|
header.appendChild(btn);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Notes-layer toolbar button as a second entry point (v13/v14 control shape). */
|
/* Token-group toolbar button (GM only). v14 controls is a keyed object and
|
||||||
|
tools fire via onChange; v13 is an array. */
|
||||||
Hooks.on("getSceneControlButtons", (controls) => {
|
Hooks.on("getSceneControlButtons", (controls) => {
|
||||||
if (!game.user?.isGM) return;
|
if (!game.user?.isGM) return;
|
||||||
|
const open = () => BlueprintNewsApp.open();
|
||||||
const tool = {
|
const tool = {
|
||||||
name: "slaBpnOpen",
|
name: "slaBpnOpen",
|
||||||
title: game.i18n.localize("SLABPN.ToolbarOpen"),
|
title: game.i18n.localize("SLABPN.ToolbarOpen"),
|
||||||
icon: "fas fa-file-contract",
|
icon: "fas fa-file-contract",
|
||||||
|
visible: true,
|
||||||
button: true,
|
button: true,
|
||||||
onClick: () => BlueprintNewsApp.open()
|
toggle: false,
|
||||||
|
onChange: open,
|
||||||
|
onClick: open
|
||||||
};
|
};
|
||||||
if (controls && typeof controls === "object" && !Array.isArray(controls)) {
|
if (controls && !Array.isArray(controls)) {
|
||||||
const notes = controls.notes;
|
const grp = controls.tokens ?? controls.token ?? null;
|
||||||
if (notes) {
|
if (grp) {
|
||||||
notes.tools ??= {};
|
grp.tools ??= {};
|
||||||
notes.tools[tool.name] ??= tool;
|
grp.tools[tool.name] = tool;
|
||||||
}
|
|
||||||
} else if (Array.isArray(controls)) {
|
|
||||||
const notes = controls.find((c) => c.name === "notes");
|
|
||||||
if (notes) {
|
|
||||||
notes.tools ??= [];
|
|
||||||
if (!notes.tools.some((t) => t.name === tool.name)) notes.tools.push(tool);
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const grp = controls.find((c) => c.name === "token" || c.name === "tokens");
|
||||||
|
if (grp) {
|
||||||
|
if (Array.isArray(grp.tools)) grp.tools.push(tool);
|
||||||
|
else { grp.tools ??= {}; grp.tools[tool.name] = tool; }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user