From 901f3e5cdc239f9c77b17cb1adaefcb59ae46821 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 19 Jan 2026 16:25:22 +0000 Subject: [PATCH] Auto stash before merge of "feature/terminal-game-engine" and "origin/feature/terminal-game-engine" --- assets/js/games/engine/input-manager.js | 8 ++++++++ assets/js/games/engine/scene-manager.js | 5 +++++ assets/js/games/games/boxing-day.js | 17 +++++++++++------ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/assets/js/games/engine/input-manager.js b/assets/js/games/engine/input-manager.js index 26658ed..6d4cbef 100644 --- a/assets/js/games/engine/input-manager.js +++ b/assets/js/games/engine/input-manager.js @@ -16,6 +16,10 @@ class InputManager { this.keydownHandler = (e) => { if (this.mode !== "options") return; + // Check if terminal input has text - if so, let user submit commands like "quit" + const terminalInput = document.getElementById("input"); + const hasInputText = terminalInput && terminalInput.value.trim().length > 0; + if (e.key === "ArrowUp") { e.preventDefault(); e.stopPropagation(); @@ -25,10 +29,14 @@ class InputManager { e.stopPropagation(); this._selectNext(); } else if (e.key === "Enter") { + // If user has typed something, let it through to submit the command + if (hasInputText) return; e.preventDefault(); e.stopPropagation(); this._confirmSelection(); } else if (/^[1-9]$/.test(e.key)) { + // Only intercept if input is empty (user isn't typing a command) + if (hasInputText) return; const index = parseInt(e.key) - 1; if (index < this.options.length) { e.preventDefault(); diff --git a/assets/js/games/engine/scene-manager.js b/assets/js/games/engine/scene-manager.js index 4a96ec5..d518a3b 100644 --- a/assets/js/games/engine/scene-manager.js +++ b/assets/js/games/engine/scene-manager.js @@ -75,6 +75,11 @@ class SceneManager { await this._renderContent(scene.content); } + // Execute onAfterRender actions (after content, before options) + if (scene.onAfterRender) { + await this._executeActions(scene.onAfterRender); + } + // Handle navigation if (scene.options) { await this._handleOptions(scene); diff --git a/assets/js/games/games/boxing-day.js b/assets/js/games/games/boxing-day.js index 2438520..513e958 100644 --- a/assets/js/games/games/boxing-day.js +++ b/assets/js/games/games/boxing-day.js @@ -86,8 +86,8 @@ const END_SCREEN = ` `; const boxingDayGame = { - id: "boxing-day", - name: "Boxing Day", + id: "system-shutdown-1999-part-1", + name: "System Shutdown: 1999 - Part 1", command: "dial", description: "Connect to Dark Tower BBS - December 26, 1999", @@ -190,9 +190,14 @@ const boxingDayGame = { className: "game-ansi-art center", }, "", - { text: "B B S - E S T . 1 9 9 6", className: "info center" }, - { text: "SysOp: NightWatchman", className: "info" }, - { text: "Users Online: 3", className: "info" }, + { + text: "---=[ B B S - E S T. 1 9 9 5 ]=---", + className: "info center", + }, + { + text: "[ Users Online - 3 ] - [ SysOp - NightWatchman ]", + className: "info center", + }, { text: "Local Time: 11:52 PM", className: "info" }, "", // New message notification (only if not read) @@ -212,7 +217,7 @@ const boxingDayGame = { content: { text: "[Returning to main menu]", className: "info" }, }, ], - onEnter: [{ set: "visited.dark_tower_main", value: true }], + onAfterRender: [{ set: "visited.dark_tower_main", value: true }], prompt: "Select:", options: [ {