Harden archive-world setup and refresh site links
All checks were successful
Build Org Website / build (push) Successful in 39s

This commit is contained in:
gitea-actions
2026-07-30 09:08:12 +01:00
parent 5b59f5745c
commit c06af38d80
35 changed files with 329 additions and 239 deletions

0
assets/scripts/pages/archive-world-audio.js Normal file → Executable file
View File

0
assets/scripts/pages/archive-world-data.js Normal file → Executable file
View File

0
assets/scripts/pages/archive-world-scenes.js Normal file → Executable file
View File

0
assets/scripts/pages/archive-world-state.js Normal file → Executable file
View File

0
assets/scripts/pages/archive-world-systems.js Normal file → Executable file
View File

0
assets/scripts/pages/archive-world-ui.js Normal file → Executable file
View File

36
assets/scripts/pages/archive-world.js Normal file → Executable file
View File

@@ -93,6 +93,7 @@
function bindSetup() {
const dialog = controller.root.querySelector("[data-world-setup]");
const form = controller.root.querySelector("[data-world-setup-form]");
if (!dialog || !form) return;
dialog.addEventListener("cancel", (event) => event.preventDefault());
form.addEventListener("submit", (event) => {
event.preventDefault();
@@ -114,6 +115,10 @@
function openSetup(message) {
const dialog = controller.root.querySelector("[data-world-setup]");
if (!dialog) {
status(message || "Traveler setup could not open. Reload the page to try again; the plain directory remains available.");
return;
}
if (message) {
controller.root.querySelector("[data-world-setup-error]").textContent = message;
status(message);
@@ -140,20 +145,20 @@
button.addEventListener("pointerdown", down);
["pointerup", "pointercancel", "pointerleave"].forEach((name) => button.addEventListener(name, up));
});
controller.root.querySelector("[data-world-interact]").addEventListener("click", () => {
bindClick("[data-world-interact]", () => {
if (controller.scene) controller.scene.interact();
});
controller.root.querySelector("[data-world-attack]").addEventListener("click", () => {
bindClick("[data-world-attack]", () => {
if (controller.scene) controller.scene.attack(controller.scene.time.now);
});
controller.root.querySelector("[data-world-item]").addEventListener("click", useSelectedItem);
controller.root.querySelector("[data-world-menu]").addEventListener("click", openMenu);
controller.root.querySelector("[data-world-quests]").addEventListener("click", () => controller.ui.openMenu(controller.state, "quests"));
controller.root.querySelector("[data-world-inventory]").addEventListener("click", () => controller.ui.openMenu(controller.state, "inventory"));
controller.root.querySelector("[data-world-journal-open]").addEventListener("click", () => controller.ui.openMenu(controller.state, "journal"));
controller.root.querySelector("[data-world-sound]").addEventListener("click", toggleSound);
controller.root.querySelector("[data-world-fullscreen]").addEventListener("click", toggleFullscreen);
controller.root.querySelector("[data-world-reset]").addEventListener("click", () => controller.ui.openMenu(controller.state, "settings"));
bindClick("[data-world-item]", useSelectedItem);
bindClick("[data-world-menu]", openMenu);
bindClick("[data-world-quests]", () => controller.ui.openMenu(controller.state, "quests"));
bindClick("[data-world-inventory]", () => controller.ui.openMenu(controller.state, "inventory"));
bindClick("[data-world-journal-open]", () => controller.ui.openMenu(controller.state, "journal"));
bindClick("[data-world-sound]", toggleSound);
bindClick("[data-world-fullscreen]", toggleFullscreen);
bindClick("[data-world-reset]", () => controller.ui.openMenu(controller.state, "settings"));
document.addEventListener("fullscreenchange", updateFullscreen);
document.addEventListener("visibilitychange", () => {
@@ -348,14 +353,16 @@
text("[data-world-player]", state.name);
text("[data-world-level]", `Lv ${state.level}`);
text("[data-world-health-text]", `${Math.ceil(state.health)} / ${state.maxHealth}`);
controller.root.querySelector("[data-world-health-bar]").style.width = `${(state.health / state.maxHealth) * 100}%`;
const healthBar = controller.root.querySelector("[data-world-health-bar]");
if (healthBar) healthBar.style.width = `${(state.health / state.maxHealth) * 100}%`;
text("[data-world-objective]", Systems.currentObjective(state));
text("[data-world-discovery-count]", `${state.discovered.length} / 8`);
text("[data-world-sigil-count]", `${state.sigils.length} / 8`);
text("[data-world-sound]", state.settings.soundEnabled ? "Sound: on" : "Sound: muted");
const selected = Data.ITEMS[state.selectedItem];
text("[data-world-selected-item]", selected ? `${selected.name} ×${Systems.itemQuantity(state, state.selectedItem)}` : "None");
controller.root.querySelector("[data-world-badge]").hidden = !state.complete;
const badge = controller.root.querySelector("[data-world-badge]");
if (badge) badge.hidden = !state.complete;
controller.root.classList.toggle("is-restored", state.story.ending);
}
@@ -394,6 +401,11 @@
if (node) node.textContent = value;
}
function bindClick(selector, handler) {
const node = controller.root.querySelector(selector);
if (node) node.addEventListener("click", handler);
}
Object.assign(controller, {
setState, renderHud, status, setPrompt, showBoss, hideBoss, openDefeat, openEnding,
openLandmark, openNpc, openChallenge, openMenu, travel, useSelectedItem, cycleItem