Auto stash before merge of "feature/terminal-game-engine" and "origin/feature/terminal-game-engine"

This commit is contained in:
Dan 2026-01-19 16:25:22 +00:00
parent 8fa11c4f00
commit 901f3e5cdc
3 changed files with 24 additions and 6 deletions

View file

@ -16,6 +16,10 @@ class InputManager {
this.keydownHandler = (e) => { this.keydownHandler = (e) => {
if (this.mode !== "options") return; 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") { if (e.key === "ArrowUp") {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@ -25,10 +29,14 @@ class InputManager {
e.stopPropagation(); e.stopPropagation();
this._selectNext(); this._selectNext();
} else if (e.key === "Enter") { } else if (e.key === "Enter") {
// If user has typed something, let it through to submit the command
if (hasInputText) return;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this._confirmSelection(); this._confirmSelection();
} else if (/^[1-9]$/.test(e.key)) { } 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; const index = parseInt(e.key) - 1;
if (index < this.options.length) { if (index < this.options.length) {
e.preventDefault(); e.preventDefault();

View file

@ -75,6 +75,11 @@ class SceneManager {
await this._renderContent(scene.content); await this._renderContent(scene.content);
} }
// Execute onAfterRender actions (after content, before options)
if (scene.onAfterRender) {
await this._executeActions(scene.onAfterRender);
}
// Handle navigation // Handle navigation
if (scene.options) { if (scene.options) {
await this._handleOptions(scene); await this._handleOptions(scene);

View file

@ -86,8 +86,8 @@ const END_SCREEN = `
`; `;
const boxingDayGame = { const boxingDayGame = {
id: "boxing-day", id: "system-shutdown-1999-part-1",
name: "Boxing Day", name: "System Shutdown: 1999 - Part 1",
command: "dial", command: "dial",
description: "Connect to Dark Tower BBS - December 26, 1999", description: "Connect to Dark Tower BBS - December 26, 1999",
@ -190,9 +190,14 @@ const boxingDayGame = {
className: "game-ansi-art center", 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: "---=[ B B S - E S T. 1 9 9 5 ]=---",
{ text: "Users Online: 3", className: "info" }, className: "info center",
},
{
text: "[ Users Online - 3 ] - [ SysOp - NightWatchman ]",
className: "info center",
},
{ text: "Local Time: 11:52 PM", className: "info" }, { text: "Local Time: 11:52 PM", className: "info" },
"", "",
// New message notification (only if not read) // New message notification (only if not read)
@ -212,7 +217,7 @@ const boxingDayGame = {
content: { text: "[Returning to main menu]", className: "info" }, 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:", prompt: "Select:",
options: [ options: [
{ {