Based on sla-blueprint-news. On Create, in a zero-engine world, also spawns playable Zero Engine npc actors for the briefing: a threat group (named leader + mooks) matched to the BPN opposition (gangs, Carrien, corpsec, Stormers, black-ops...) plus the named cast — each with attributes, hit points, armour, damage, threat and embedded weapons. Stat blocks mirror the system's own NPC Creator (SLA_NPC_TYPES / _slaWeaponData). De-collided ids/globals/buttons so it coexists with the base module. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
60 lines
2.1 KiB
JavaScript
60 lines
2.1 KiB
JavaScript
/**
|
|
* SLA Blueprint News — entry point.
|
|
*
|
|
* Thin Foundry wrapper around the engine-agnostic component vendored under
|
|
* module/vendor/. Registers a global API and a Journal-directory button that
|
|
* opens the generator; the generator writes briefings into journal entries.
|
|
*/
|
|
|
|
import { BlueprintNewsApp } from "./app/generator-app.mjs";
|
|
|
|
const MODULE_ID = "sla-blueprint-news-zero";
|
|
|
|
Hooks.once("init", () => {
|
|
game.slaBlueprintNewsZero = { open: () => BlueprintNewsApp.open() };
|
|
});
|
|
|
|
/* Journal directory header button (GM only) — the natural home, since this
|
|
tool produces journal entries. */
|
|
Hooks.on("renderJournalDirectory", (_app, html) => {
|
|
if (!game.user?.isGM) return;
|
|
const root = html instanceof HTMLElement ? html : html?.[0];
|
|
if (!root) return;
|
|
const header =
|
|
root.querySelector(".directory-header .action-buttons") ??
|
|
root.querySelector(".directory-header .header-actions") ??
|
|
root.querySelector(".directory-header");
|
|
if (!header || header.querySelector(".sla-bpn-zero-open")) return;
|
|
const btn = document.createElement("button");
|
|
btn.type = "button";
|
|
btn.className = "sla-bpn-open sla-bpn-zero-open";
|
|
btn.innerHTML = `<i class="fas fa-skull"></i> Blueprint News 0E`;
|
|
btn.addEventListener("click", () => BlueprintNewsApp.open());
|
|
header.appendChild(btn);
|
|
});
|
|
|
|
/* Notes-layer toolbar button as a second entry point (v13/v14 control shape). */
|
|
Hooks.on("getSceneControlButtons", (controls) => {
|
|
if (!game.user?.isGM) return;
|
|
const tool = {
|
|
name: "slaBpnZeroOpen",
|
|
title: "Open Blueprint News 0 Engine",
|
|
icon: "fas fa-skull",
|
|
button: true,
|
|
onClick: () => BlueprintNewsApp.open()
|
|
};
|
|
if (controls && typeof controls === "object" && !Array.isArray(controls)) {
|
|
const notes = controls.notes;
|
|
if (notes) {
|
|
notes.tools ??= {};
|
|
notes.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);
|
|
}
|
|
}
|
|
});
|