Skip to content

Fix combat-sandbox.html DOM access errors from sandboxMode#33

Open
Copilot wants to merge 7 commits intocopilot/refactor-defensesystem-damagefrom
copilot/add-sandbox-mode-to-game-js
Open

Fix combat-sandbox.html DOM access errors from sandboxMode#33
Copilot wants to merge 7 commits intocopilot/refactor-defensesystem-damagefrom
copilot/add-sandbox-mode-to-game-js

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

combat-sandbox.html broke after sandboxMode implementation. TypeError occurred when UISystem.updateHUD() attempted to set textContent on null DOM elements that don't exist in the sandbox environment.

Changes

Combat Sandbox Fix

  • Override all UI methods that access DOM after game instantiation
  • Methods disabled: updateHUD, showScreen, showWaveAnnouncement, showLevelUp, showGameOver
  • Prevents TypeError: Cannot set properties of null while maintaining sandbox functionality

Obsolete File Cleanup

  • Reverted combat-sandbox-pro.html to original state (marked obsolete per maintainer)

Technical Details

sandboxMode disables ui.update() at engine level, but other UI methods remain callable. When invoked by game systems, they fail accessing non-existent DOM elements:

// After: explicit method stubs prevent DOM access
if (game.systems.ui) {
    game.systems.ui.updateHUD = function() {};
    game.systems.ui.showScreen = function() {};
    game.systems.ui.showWaveAnnouncement = function() {};
    game.systems.ui.showLevelUp = function() {};
    game.systems.ui.showGameOver = function() {};
    console.log('[Combat Sandbox] UI methods overridden to prevent DOM errors');
}

Result

Combat sandbox fully operational:

  • Player/enemy spawning ✓
  • Weapon systems ✓
  • Defense calculations ✓
  • No console errors ✓

Combat sandbox working with enemies


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 14, 2026 22:31
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
@Linkatplug Linkatplug marked this pull request as ready for review February 14, 2026 22:35
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 741d825407

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Copilot AI changed the title [WIP] Add real sandboxMode to Game.js Add sandboxMode option to Game.js for system-level testing control Feb 14, 2026
Copilot AI requested a review from Linkatplug February 14, 2026 22:39
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Copilot AI changed the title Add sandboxMode option to Game.js for system-level testing control Refactor sandbox files to use Game.js sandboxMode option Feb 14, 2026
Co-authored-by: Linkatplug <36280686+Linkatplug@users.noreply.github.com>
Copilot AI changed the title Refactor sandbox files to use Game.js sandboxMode option Fix combat-sandbox.html DOM access errors from sandboxMode Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants