Add map welcom page

This commit is contained in:
2026-04-09 23:55:32 +02:00
parent 71abfc3488
commit d71077d033
7 changed files with 62 additions and 4 deletions

View File

@@ -139,6 +139,9 @@ Hooks.once("ready", async function () {
await item.delete()
}
}
// Auto-import the welcome scene if GM and not already present
if (game.user.isGM) await _importWelcomeScene()
})
// Auto-link regiment (and army) actor tokens so they can be added to garrisons/armies
@@ -167,3 +170,33 @@ Hooks.on("renderChatMessageHTML", (message, html) => {
// Inject Free Roll bar into the chat sidebar
Hooks.on("renderChatLog", (_chatLog, html) => injectFreeRollBar(_chatLog, html))
// ============================================================
// WELCOME SCENE — auto-create on first world load (GM only)
// ============================================================
const WELCOME_SCENE_NAME = "Oath Hammer"
const WELCOME_SCENE_MAP = "systems/fvtt-oath-hammer/assets/images/oathhammer_map.webp"
/** Scene data for the welcome map (3600×5400 px, no grid — world map). */
function _welcomeSceneData() {
return {
name: WELCOME_SCENE_NAME,
background: { src: WELCOME_SCENE_MAP },
width: 3600,
height: 5400,
grid: { type: 0, size: 100 }, // gridless
padding: 0,
initial: { x: 1800, y: 2700, scale: 0.25 },
tokenVision: false,
flags: { "fvtt-oath-hammer": { welcomeScene: true } },
}
}
async function _importWelcomeScene() {
// Skip if the scene already exists in the world
if (game.scenes.find(s => s.name === WELCOME_SCENE_NAME)) return
console.info("Oath Hammer | Creating welcome scene…")
const scene = await Scene.create(_welcomeSceneData())
await scene.activate()
console.info("Oath Hammer | Welcome scene created and activated.")
}