Commit Graph

69 Commits

Author SHA1 Message Date
Z. Cliffe Schreuders
61afc0a666 Refactor character assets and player preferences
- Deleted unused character images: woman_in_science_lab_coat.png and woman_with_black_long_hair_bow_in_hair_long_sleeve_(1).png.
- Added new padlock icon asset for UI.
- Introduced player_preferences.css for styling the player preferences configuration screen.
- Updated game.js to load new character atlases with simplified filenames.
- Enhanced player.js to create custom idle animations for characters.
- Implemented sprite-grid.js for sprite selection UI, including a preview feature.
- Updated database schema to include break_escape_player_preferences table for storing player settings.
- Modified convert_pixellab_to_spritesheet.py to map character names to simplified filenames and extract headshots from character images.
2026-02-12 14:35:14 +00:00
Z. Cliffe Schreuders
fb6e9b603c Enhance character sprite loading and animation handling
- Updated the game to support new character sprite atlases for both male and female characters, allowing for a wider variety of NPC designs.
- Improved player sprite initialization to dynamically select between atlas-based and legacy sprites, enhancing flexibility in character representation.
- Refined collision box settings based on sprite type, ensuring accurate physics interactions for both atlas (80x80) and legacy (64x64) sprites.
- Enhanced NPC behavior to utilize atlas animations, allowing for more fluid and diverse animations based on available frames.

Files modified:
- game.js: Added new character atlases and updated sprite loading logic.
- player.js: Improved player sprite handling and collision box adjustments.
- npc-behavior.js: Updated animation handling for NPCs to support atlas-based animations.
- npc-sprites.js: Enhanced NPC sprite creation to accommodate atlas detection and initial frame selection.
- scenario.json.erb: Updated player and NPC configurations to utilize new sprite sheets and animation settings.
- m01_npc_sarah.ink: Revised dialogue options to include new interactions related to NPCs.
2026-02-11 00:18:21 +00:00
Z. Cliffe Schreuders
d1e38bad29 Refactor inventory handling to prevent duplicates and clean up game state
- Updated the games_controller to remove starting items from the inventory response, ensuring no duplicates are sent to the client.
- Enhanced the inventory processing logic in JavaScript to check for existing items by ID, type, or name before adding new items, preventing duplicate entries in the player's inventory.

Files modified:
- games_controller.rb: Adjusted inventory response handling.
- inventory.js: Added duplicate item check during inventory processing.
2026-02-10 16:17:36 +00:00
Z. Cliffe Schreuders
6847fca429 Add keyboard controls for choice selection in PersonChatMinigame
- Implemented keyboard event handling to allow players to use the spacebar to continue and number keys (1-9) to select choices in the minigame.
- Updated UI to display choice buttons with number prefixes for easier selection.

Files modified:
- person-chat-minigame.js: Added keyboard event listener for choice selection.
- person-chat-ui.js: Updated choice button creation to include number prefixes.
2026-02-10 16:07:28 +00:00
Z. Cliffe Schreuders
5c28743144 Update CSS file paths and enhance tutorial system
- Changed CSS file paths in index.html and show.html.erb to reflect new directory structure under public/break_escape.
- Added a new tutorial.css file with styles tailored for the tutorial system, ensuring a cohesive pixel-art aesthetic.
- Enhanced the tutorial manager to track player interactions, including clicks to move and inventory item usage, improving the tutorial experience for new players.
- Updated tutorial steps to dynamically include objectives based on the current scenario.

Files modified:
- index.html: Updated CSS links.
- show.html.erb: Updated CSS links.
- tutorial.css: New styles for the tutorial system.
- player.js: Added notifications for player actions.
- tutorial-manager.js: Enhanced logic for tracking tutorial progress and objectives.
- interactions.js: Added notifications for inventory interactions.
2026-01-19 09:54:15 +00:00
Z. Cliffe Schreuders
1a8da6df23 Add interactive tutorial system for new players
Implements a comprehensive tutorial system that:
- Prompts first-time players with option to take tutorial
- Detects device type (mobile vs keyboard) for appropriate instructions
- Shows interactive steps with objectives for basic controls:
  * Keyboard: WASD movement, Shift to run, E to interact
  * Mobile: Click/tap to move and interact
- Tracks player actions to progress through tutorial steps
- Saves completion status in localStorage
- Includes polished UI with animations and responsive design

Files added:
- tutorial-manager.js: Core tutorial logic and state management
- tutorial.css: Styled UI components with animations

Files modified:
- game.js: Integrated tutorial check on first load
- player.js: Added tutorial notifications for movement/running
- interactions.js: Added tutorial notification for interactions
- main.js: Imported tutorial manager system
- index.html: Added tutorial CSS stylesheet
2026-01-14 10:10:12 +00:00
Z. Cliffe Schreuders
53881d5767 Fix door and room loading issues with multiple paths
Fixes two critical issues when multiple doors lead to the same room:

1. Room reloading: Added checks in loadRoom() and createRoom() to prevent
   reloading/recreating rooms that are already loaded. This prevents the
   room from being unnecessarily recreated when opening a second door to
   the same room.

2. Door location detection: Updated removeMatchingDoorSprite() to use
   position and direction when finding the matching door. Previously it
   only checked connectedRoom, which caused it to remove the wrong door
   when multiple doors connected the same two rooms at different locations.
   Now it checks:
   - Opposite direction matches
   - Position matches within tolerance (X for N/S doors, Y for E/W doors)

This ensures that opening different doors to the same room works correctly
without causing room reloads or removing the wrong door sprites.
2026-01-14 10:02:08 +00:00
Z. Cliffe Schreuders
d2b78b9d54 Clean up trailing whitespace in migration and CSS files
- Removed unnecessary trailing whitespace from `remove_unique_game_constraint.rb`, `flag-station-minigame.css`, `vm-launcher-minigame.css`, and `hacktivity-cable.js` to enhance code quality and maintain consistency across the codebase.
2026-01-13 09:39:14 +00:00
Z. Cliffe Schreuders
aad985ee98 Add new functionality to open workstations in new tabs
- Introduced buttons in the Crypto and Lab Workstation title bars to allow users to open the respective workstations in new tabs.
- Implemented JavaScript functions `openCryptoWorkstationInNewTab` and `openLabWorkstationInNewTab` to handle the new tab functionality.
- Updated CSS styles for the new buttons to ensure proper positioning and visual appeal.
- Made necessary imports and exports in helper files to integrate the new functionality across the application.
2025-12-05 15:37:31 +00:00
Z. Cliffe Schreuders
c7d9f5e3cf Update migration and CSS files to remove trailing whitespace
- Cleaned up trailing whitespace in migration file `remove_unique_game_constraint.rb` to maintain code quality.
- Removed unnecessary whitespace from CSS files for `flag-station-minigame.css` and `vm-launcher-minigame.css`, ensuring cleaner stylesheets.
- Tidied up JavaScript file `hacktivity-cable.js` by eliminating trailing whitespace, improving readability and consistency across the codebase.
2025-12-04 23:15:38 +00:00
Z. Cliffe Schreuders
d327380fac Enhance scenario validation and improve timed conversation structure
- Updated `validate_scenario.rb` to enforce correct usage of `targetKnot` in timed conversations, ensuring compliance with new requirements.
- Added checks for missing properties in timed conversations, including `delay` and `targetKnot`, to improve scenario integrity.
- Enhanced logging for validation issues, providing clearer feedback on scenario configuration errors.
- Updated relevant scenarios to align with the new validation rules, ensuring consistency across gameplay elements.
2025-12-04 23:15:03 +00:00
Z. Cliffe Schreuders
629aa229b3 Enhance inventory and container management for improved gameplay experience
- Added functionality to include current player inventory in game state for page reload recovery, allowing players to restore their inventory seamlessly.
- Implemented filtering of container contents to exclude items already in the player's inventory, enhancing user experience and gameplay clarity.
- Updated game mechanics to support both type-based and ID-based matching for inventory items, improving task validation and objectives tracking.
- Enhanced logging for better visibility into inventory processing and container content loading, aiding in debugging and game state management.
- Updated scenarios to reflect changes in item identification and task requirements, ensuring consistency across gameplay elements.
2025-12-04 15:42:01 +00:00
Z. Cliffe Schreuders
333ea39c56 Implement submit_flags task functionality and enhance game mechanics
- Added support for submit_flags tasks in GamesController, allowing players to submit flags for validation and task completion.
- Updated game state management to track submitted flags and validate against required flags for task completion.
- Enhanced ObjectivesManager to handle flag submissions, including syncing progress with the server and managing task states.
- Introduced a new locksmith NPC for lockpicking tutorials, expanding gameplay elements and player engagement.
- Updated scenario schema to include submit_flags task type and associated properties, ensuring proper integration into the game mechanics.
- Improved logging and debugging information for flag submissions and task progress updates, enhancing visibility into game state changes.
2025-12-04 14:00:26 +00:00
Z. Cliffe Schreuders
e1d3b1ff2c Enhance FlagStationMinigame and scenario structure
- Added functionality to complete tasks via the objectives manager in FlagStationMinigame, improving gameplay interaction.
- Updated scenario.json.erb to replace flags_submitted with specific SSH and privilege flag submissions, enhancing clarity in task objectives.
- Introduced new task types in the scenario schema to support task completion mechanics, ensuring better integration of gameplay elements.
2025-12-04 08:40:25 +00:00
Z. Cliffe Schreuders
289c0ce1c7 Add lab workstation functionality and integrate into gameplay
- Introduced a lab workstation popup in the game interface for accessing lab sheets via an iframe.
- Implemented JavaScript functions to create, open, and close the lab workstation, enhancing user interaction.
- Updated CSS styles for the lab workstation popup to ensure a seamless visual experience.
- Enhanced interaction handling to allow players to open lab workstations from inventory items.
- Added new scenario files for the Linux Fundamentals and Security Lab, including detailed instructions and objectives for players.
- Updated scenario schema to include the new lab workstation type, ensuring proper integration into the game mechanics.
2025-12-04 02:10:35 +00:00
Z. Cliffe Schreuders
49fc995cb3 Enhance scenario schema and validation scripts
- Updated scenario-schema.json to include "tutorial" as a valid difficulty level.
- Changed position coordinates from integer to number for better precision.
- Added new item types ("id_badge", "rfid_cloner") in scenario schema with descriptions.
- Improved validate_scenario.rb to check for common issues, including room connection directions and NPC configurations.
- Added suggestions for gameplay improvements based on scenario features.
- Updated SCENARIO_JSON_FORMAT_GUIDE.md to clarify valid directions and bidirectional connections.
- Introduced guidelines for lock type variety and progression in room layout design.
- Established dialogue pacing rules in Ink scripting to enhance player engagement.
- Included validation steps in scenario assembly documentation to ensure structural integrity.
2025-12-02 10:37:57 +00:00
Z. Cliffe Schreuders
a4606f596c Enhance NPC encounter logging and fix item type references in scenario scripts 2025-12-01 17:31:12 +00:00
Z. Cliffe Schreuders
ce53d60ff1 Reduce duration of failure and success messages in PasswordMinigame for improved user experience
- Decreased the display time for various failure and success messages from 3000ms to 1000ms or 1500ms, enhancing responsiveness during gameplay.
- Adjusted the cancellation message display time from 2000ms to 800ms for quicker feedback.
2025-11-30 00:23:56 +00:00
Z. Cliffe Schreuders
5d9f83192d Implement keyboard input pause for text entry in FlagStationMinigame
- Added functionality to disable WASD key capture during text input, enhancing user experience.
- Implemented a fallback mechanism to dynamically import the pauseKeyboardInput method if not available on the window object, ensuring compatibility across different environments.
2025-11-30 00:04:42 +00:00
Z. Cliffe Schreuders
a8c4f6576f Enhance standalone mode with VM IP handling and UI updates
- Updated `GamesController` to parse and store VM IPs from JSON input, improving player state management.
- Modified `Game` model to include VM IPs in the context for better integration with gameplay.
- Enhanced `Mission` model's `vm_object` method to override IPs from the context when available.
- Revamped `new.html.erb` to provide a clearer interface for entering VM IP addresses and flag hints.
- Improved `vm-launcher-minigame.js` to display VM IPs and provide connection instructions in standalone mode.
2025-11-30 00:02:08 +00:00
Z. Cliffe Schreuders
ef8e2f294a Refactor RFID handling and enhance game logic
- Updated `GamesController` and `Game` model to include RFID lock types in the filtering logic for 'requires' attributes, ensuring proper handling of biometric, bluetooth, and RFID types.
- Improved `RFIDMinigame` to standardize card ID retrieval, supporting both `card_id` and `key_id`.
- Enhanced `unlock-system.js` to prioritize physical keycard checks and streamline the unlocking process with detailed logging.
- Adjusted scenario JSON files to replace `keyId` with `card_id` for consistency and added new lock requirements for various rooms.
2025-11-29 23:43:30 +00:00
Z. Cliffe Schreuders
92330b04dc Enhance flag handling and XML integration for standalone mode
- Updated `GamesController` to support XML flag hints for standalone mode, improving backward compatibility with legacy flag input.
- Introduced `parse_flag_hints_xml` method in `Mission` model to extract flags from XML content.
- Enhanced `Game` model to incorporate `flags_by_vm` from player state for better flag management.
- Modified `new.html.erb` to update UI for flag hints input, replacing the previous comma-separated flags format.
- Improved `FlagStationMinigame` to display accepted VM flags and handle flag submissions more effectively.
- Adjusted scenario JSON to include flag stations with VM-specific flag handling.
2025-11-29 20:57:39 +00:00
Z. Cliffe Schreuders
bb2b0c206e Implement VM object retrieval and enhance game visuals
- Added `vm_object` method in `mission.rb` to fetch VM details from context or return a fallback.
- Introduced new images for VM launchers and flag stations in the assets directory.
- Updated `game.js` to preload new VM launcher and flag station images.
- Refactored `vm-launcher-minigame.js` to streamline VM handling and improve UI messaging.
- Adjusted scenario JSON to utilize the new `vm_object` method for VM data retrieval.
2025-11-29 01:35:20 +00:00
Z. Cliffe Schreuders
ca44cef068 Enhance game setup for VM and standalone modes
- Updated `GamesController` to use `current_player` for VM set retrieval.
- Improved `MissionsController` to handle redirection for both Hacktivity and standalone modes.
- Modified `new.html.erb` to include UI for standalone flag input alongside VM set selection.
- Added new CSS styles for standalone mode instructions and flags input form.
- Introduced new mission configuration for the SecGen VM Lab, integrating VM and flag capture elements.
2025-11-28 17:41:17 +00:00
Z. Cliffe Schreuders
ea079b11c9 WiP implementing VM integration 2025-11-28 15:36:10 +00:00
Z. Cliffe Schreuders
f4aef2a561 feat: Improve NPC dialogue and objectives handling with global variable synchronization and task unlocking 2025-11-26 14:49:30 +00:00
Z. Cliffe Schreuders
9aaec1a970 feat: Enhance NPC dialogue and objectives system with event mappings for secret mission completion 2025-11-26 13:02:55 +00:00
Z. Cliffe Schreuders
412cebb65c feat: Add objectives system with policy methods and test scenarios 2025-11-26 09:43:06 +00:00
Z. Cliffe Schreuders
9d6d7709c3 feat: Implement Objectives System with UI and Server Sync
- Added ObjectivesManager to track mission objectives and tasks.
- Created ObjectivesPanel for displaying objectives in a collapsible HUD.
- Integrated objectives state restoration from the server during game initialization.
- Implemented task completion and unlocking mechanisms via game actions.
- Added CSS styles for the objectives panel with a pixel-art aesthetic.
- Developed a test scenario to validate the objectives system functionality.
- Updated database schema to include fields for tracking completed objectives and tasks.
2025-11-26 00:50:32 +00:00
Z. Cliffe Schreuders
150518b4c4 feat: Include objectives state in server response and implement event emissions for door unlocks and key pickups 2025-11-25 23:19:11 +00:00
Z. Cliffe Schreuders
659644b3da feat: Update CyBOK logo and enhance mission index styles with new CSS files 2025-11-25 16:03:09 +00:00
Z. Cliffe Schreuders
0d7ba1f2fc feat: Enhance key selection process by storing original inventory keys and correct key ID for retries 2025-11-24 13:52:07 +00:00
Z. Cliffe Schreuders
5ecfa5db27 feat: Implement KeyCutCalculator utility for consistent key cut depth calculations across the game
refactor: Update key-lock system and minigame starters to utilize KeyCutCalculator for cut depth generation
chore: Normalize keyPins in scenario data to align with new cut depth calculations
2025-11-24 13:41:35 +00:00
Z. Cliffe Schreuders
b4b95928da feat: Enhance inventory management with server-side validation and CSRF protection 2025-11-24 11:17:39 +00:00
Z. Cliffe Schreuders
2c8757de3e Add character registry and NPC management features
- Implemented a global character registry to manage player and NPC data.
- Added methods for setting the player, registering NPCs, and retrieving character information.
- Integrated character registry updates into the NPC manager for seamless NPC registration.
- Created test scenarios for line prefix speaker format, including narrator modes and background changes.
- Developed comprehensive NPC sprite test scenario with various NPC interactions and items.
2025-11-24 02:21:31 +00:00
Z. Cliffe Schreuders
5a997e38f7 Enhance NPC collision detection: add checks for table objects in NPC behavior and log successful collisions for better debugging. 2025-11-23 10:39:44 +00:00
Z. Cliffe Schreuders
59f096fdba Add wall escape functionality for NPCs: implement checks and escape logic for NPCs stuck in walls, enhancing collision handling and movement responsiveness. 2025-11-23 01:46:04 +00:00
Z. Cliffe Schreuders
98104b59a8 Enhance NPC behavior: implement home return functionality for stationary NPCs when pushed away from their starting position 2025-11-23 01:27:20 +00:00
Z. Cliffe Schreuders
279cc0125d Fix avatar URL resolution in contact list: ensure full URL is used for non-relative avatar paths 2025-11-22 13:59:21 +00:00
Z. Cliffe Schreuders
140def5650 Add Spotify play button and styles for improved music integration 2025-11-22 01:54:00 +00:00
Z. Cliffe Schreuders
f8bdb73a06 Improve door and unlock interaction handling: deactivate door sprites immediately upon opening, clean up interaction indicators, and ensure proper checks for inactive or destroyed doors. 2025-11-22 01:37:41 +00:00
Z. Cliffe Schreuders
83055f7589 Cancel click-to-move when keyboard input is detected to improve player control responsiveness 2025-11-22 01:30:44 +00:00
Z. Cliffe Schreuders
ac727f4422 Enhance unlock functionality: refactor door unlocking to async, validate NPC permissions via server, and ensure player state integrity 2025-11-22 01:25:36 +00:00
Z. Cliffe Schreuders
c5eca9cc60 Fix NPC unlock race condition with persistent server-side tracking
PROBLEM:
NPC unlocks had timing-dependent behavior:
- If NPC unlocked door BEFORE room loaded: client saw it as unlocked
- If NPC unlocked door AFTER room loaded: door sprite stayed locked

SOLUTION:
1. Server-side persistent tracking:
   - Added npcUnlockedTargets array to player_state
   - Track all NPC unlocks separately from unlockedRooms/unlockedObjects
   - Initialize npcUnlockedTargets in new games

2. Server merges NPC unlock state:
   - filtered_room_data checks npcUnlockedTargets
   - Marks doors/containers as unlocked if NPC unlocked them
   - Works regardless of when room is loaded

3. Client updates existing sprites:
   - NPC unlock handler finds ALL door sprites for target room
   - Updates sprite state immediately after server unlock
   - Handles both pre-loaded and late-loaded rooms

Changes:
- app/models/break_escape/game.rb: Add npc_unlock_target!, npc_unlocked?, merge state in filtered_room_data
- app/controllers/break_escape/games_controller.rb: Track NPC unlocks in unlock endpoint
- public/break_escape/js/minigames/person-chat/person-chat-conversation.js: Update all door sprites after NPC unlock
- public/break_escape/js/systems/doors.js: Export unlockDoor globally
- test/integration/unlock_system_test.rb: Add 4 tests for persistent NPC unlock state
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
d3b31b4368 Add comprehensive unlock system tests
Created test suite with 34 tests covering all unlock scenarios and security:

DOOR TESTS (10 tests):
- PIN/password validation (correct/incorrect, case sensitivity)
- Key unlocks (client-validated)
- Unlocked doors (method='unlocked')

CONTAINER TESTS (8 tests):
- PIN/password validation
- Key, lockpick, biometric, bluetooth, RFID unlocks
- Unlocked containers

NPC UNLOCK TESTS (6 tests):
 NPC can unlock door/container if encountered and has permission
🔒 SECURITY: Fails if NPC not encountered
🔒 SECURITY: Fails if NPC lacks permission for that target
🔒 SECURITY: Fails for non-existent NPC
🔒 SECURITY: Fails if unlockable is not an array

SECURITY TESTS - BYPASS PREVENTION (4 tests):
🔒 CRITICAL: Locked door CANNOT be bypassed with method='unlocked'
🔒 CRITICAL: Locked container CANNOT be bypassed with method='unlocked'
 Unlocked door CAN use method='unlocked'
 Unlocked container CAN use method='unlocked'

ERROR CASES (3 tests):
- Non-existent doors/objects return 422
- Invalid methods return 422

DATA FILTERING (2 tests):
- Verify 'requires' field filtered from responses
- Verify recursive filtering of contents

INTEGRATION (1 test):
- Multiple sequential unlocks
- Idempotent operations

Test Results: 34 runs, 115 assertions, 0 failures

Server Implementation:
- validate_npc_unlock: Validates NPC encounter and permission list
- find_npc_in_scenario: Searches all rooms for NPC
- method='npc': New unlock method requiring NPC id as attempt

Client Implementation:
- Updated handleUnlockDoor to call server API with method='npc'
- Server validates all NPC unlock requests
- No client-side lock manipulation

Security Principle: All unlock authorization is server-side.
Client cannot bypass locks by manipulating state or claiming NPC unlocks.
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
bda90baeab Fix unlocked doors/containers not opening after security changes
Fixed issue where unlocked doors and containers wouldn't open because
getLockRequirements functions returned null for unlocked items, causing
early return.

Changes:
- Handle case where lockRequirements is null (unlocked item) by calling
  server verification
- Updated getLockRequirementsForDoor to return data even for unlocked doors
- Updated getLockRequirementsForItem to include 'locked' field
- Now both locked and unlocked items go through proper server validation

Flow for unlocked items:
1. getLockRequirements returns null (no lock data) OR returns {locked: false}
2. Call notifyServerUnlock with method='unlocked'
3. Server validates item is actually unlocked in scenario_data
4. Server returns roomData (doors) or contents (containers)
5. Client proceeds to open/display content
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
424f69186c SECURITY: Enforce server-side validation for all door/container access
Critical security fix: Removed client-side lock state checking that allowed
bypass of server validation. Clients can no longer manipulate lock states to
gain unauthorized access.

Previous vulnerability:
- Client checked props.locked (client-side data)
- If false, directly called notifyServerUnlock with method='unlocked'
- Server trusted this without validating its own scenario data
- Attacker could: set doorSprite.doorProperties.locked = false, then access

New secure flow:
- Client ALWAYS calls handleUnlock regardless of perceived lock state
- handleUnlock calls server with method='unlocked' for unlocked items
- Server ALWAYS validates against its own scenario_data
- Server only grants access if item is actually unlocked in server state
- Client state is never trusted for authorization decisions

Changes:
- doors.js: Removed client-side lock check, always call handleUnlock
- unlock-system.js: Handle unlocked items by verifying with server
- interactions.js: Removed client-side container lock check
- interactions.js: Removed notifyServerForUnlockedContainer helper

Security principle: Never trust the client. All authorization must be
server-side based on server state, not client-reported state.
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
cda71cf6f3 SECURITY: Enforce server-side validation for all PIN/password attempts
Critical security fix: PIN and password minigames were falling back to
client-side validation when the correct answer was available. This allowed
players to bypass security by inspecting client-side code.

Changes:
- PIN minigame: ALWAYS use server-side validation, never client-side
- Password minigame: ALWAYS use server-side validation, never client-side
- If API client is unavailable, fail securely by rejecting the attempt
- Removed backwards compatibility code that allowed client-side validation

Security principle: Never trust the client for authentication/authorization.
All PIN and password validation must go through the server.
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
d59aaf51f9 Export notifyServerUnlock from unlock-system.js
Fixed ReferenceError where notifyServerUnlock was not defined in doors.js.
The function was internal to unlock-system.js but is now needed by doors.js
for notifying the server when unlocked doors are opened.

Changes:
- Export notifyServerUnlock from unlock-system.js
- Import notifyServerUnlock in doors.js
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
b2c8362d91 Allow unlocked doors and containers to notify server for access
Fixed issue where unlocked doors/containers couldn't be opened because
the server wasn't being notified to add them to unlockedRooms/unlockedObjects.

Server changes (game.rb):
- Updated validate_unlock to accept method='unlocked' for unlocked targets
- Added logic to grant access for unlocked doors/objects without validation

Client changes (doors.js):
- Updated handleDoorInteraction to notify server for unlocked doors
- Calls notifyServerUnlock with method='unlocked' before opening

Client changes (interactions.js):
- Added notifyServerForUnlockedContainer helper function
- Updated container interaction to notify server before launching minigame

This ensures that all room/container access is properly authorized on the
server side, preventing 403 Forbidden errors when loading room/container data.
2025-11-22 00:46:56 +00:00