fix: Correct room type keys in test scenarios and add new room types to preload

Fixed issue where test scenarios couldn't load rooms:

1. Added new room types to game preload:
   - small_room_1x1gu (1×1 GU closet)
   - hall_1x2gu (2×1 GU wide hallway)

2. Corrected room type keys in all test scenarios:
   - room_reception2 → room_reception
   - room_office2 → room_office
   - room_ceo2 → room_ceo
   - room_servers2 → room_servers

The issue was that scenarios referenced room file names (room_reception2)
instead of the Phaser cache keys (room_reception). The game preloads rooms
with specific keys that map to the JSON files:
  this.load.tilemapTiledJSON('room_reception', 'assets/rooms/room_reception2.json')

Scenarios must use the key ('room_reception'), not the filename.

Files updated:
- js/core/game.js: Added preload for new variable-sized rooms
- scenarios/test_vertical_layout.json
- scenarios/test_horizontal_layout.json
- scenarios/test_complex_multidirection.json
- scenarios/test_multiple_connections.json
- scenarios/test_mixed_room_sizes.json

All test scenarios should now load correctly.
This commit is contained in:
Claude
2025-11-16 16:58:21 +00:00
parent 4d6f6d5a90
commit 09c778daaa
6 changed files with 26 additions and 22 deletions

View File

@@ -35,6 +35,10 @@ export function preload() {
this.load.tilemapTiledJSON('room_closet', 'assets/rooms/room_closet2.json');
this.load.tilemapTiledJSON('room_servers', 'assets/rooms/room_servers2.json');
// Load new variable-sized rooms for grid system
this.load.tilemapTiledJSON('small_room_1x1gu', 'assets/rooms/small_room_1x1gu.json');
this.load.tilemapTiledJSON('hall_1x2gu', 'assets/rooms/hall_1x2gu.json');
// Load room images (now using smaller 32px scale images)
this.load.image('room_reception', 'assets/tiles/rooms/room1.png');
this.load.image('room18', 'assets/tiles/rooms/room18.png');

View File

@@ -12,7 +12,7 @@
],
"rooms": {
"reception": {
"type": "room_reception2",
"type": "room_reception",
"connections": {
"north": "office2"
},
@@ -26,7 +26,7 @@
]
},
"office2": {
"type": "room_office2",
"type": "room_office",
"locked": true,
"lockType": "key",
"requires": "office2_key",
@@ -59,7 +59,7 @@
]
},
"office1": {
"type": "room_office2",
"type": "room_office",
"locked": true,
"lockType": "key",
"requires": "office1_key",
@@ -84,7 +84,7 @@
]
},
"storage": {
"type": "room_office2",
"type": "room_office",
"locked": true,
"lockType": "key",
"requires": "storage_key",
@@ -101,7 +101,7 @@
]
},
"servers": {
"type": "room_servers2",
"type": "room_servers",
"locked": true,
"lockType": "key",
"requires": "server_key",
@@ -119,7 +119,7 @@
]
},
"ceo": {
"type": "room_ceo2",
"type": "room_ceo",
"locked": true,
"lockType": "key",
"requires": "ceo_key",

View File

@@ -3,7 +3,7 @@
"startRoom": "reception",
"rooms": {
"reception": {
"type": "room_reception2",
"type": "room_reception",
"connections": {
"north": "office"
},
@@ -24,7 +24,7 @@
]
},
"office": {
"type": "room_office2",
"type": "room_office",
"locked": true,
"lockType": "key",
"requires": "office_key",
@@ -44,7 +44,7 @@
]
},
"storage": {
"type": "room_office2",
"type": "room_office",
"connections": {
"east": "office"
},
@@ -65,7 +65,7 @@
]
},
"servers": {
"type": "room_servers2",
"type": "room_servers",
"locked": true,
"lockType": "key",
"requires": "server_key",

View File

@@ -1,9 +1,9 @@
{
"scenario_brief": "Test Scenario: Mixed Room Sizes\n\nThis scenario demonstrates the grid system's ability to handle rooms of different sizes and properly align doors between them.\n\nRoom Sizes Used:\n- 1×1 GU (Closet): 5×6 tiles = 160×192px (small_room_1x1gu.json)\n- 2×1 GU (Hall): 10×6 tiles = 320×192px (hall_1x2gu.json)\n- 2×2 GU (Standard): 10×10 tiles = 320×320px (room_office2.json, room_ceo2.json)\n\nLayout:\n [Closet-1×1] [CEO-2×2]\n ↑ ↑\n [Wide Hall-2×1]\n ↑\n [Reception-2×2]\n\nTests:\n- Different room sizes in same scenario\n- Door alignment between different-sized rooms\n- Centering of smaller rooms on larger rooms\n- Wide horizontal hallway (2×1 GU)\n- Grid-based positioning with varied dimensions",
"scenario_brief": "Test Scenario: Mixed Room Sizes\n\nThis scenario demonstrates the grid system's ability to handle rooms of different sizes and properly align doors between them.\n\nRoom Sizes Used:\n- 1×1 GU (Closet): 5×6 tiles = 160×192px (small_room_1x1gu)\n- 2×1 GU (Hall): 10×6 tiles = 320×192px (hall_1x2gu)\n- 2×2 GU (Standard): 10×10 tiles = 320×320px (room_reception, room_ceo)\n\nLayout:\n [Closet-1×1] [CEO-2×2]\n ↑ ↑\n [Wide Hall-2×1]\n ↑\n [Reception-2×2]\n\nTests:\n- Different room sizes in same scenario\n- Door alignment between different-sized rooms\n- Centering of smaller rooms on larger rooms\n- Wide horizontal hallway (2×1 GU)\n- Grid-based positioning with varied dimensions",
"startRoom": "reception",
"rooms": {
"reception": {
"type": "room_reception2",
"type": "room_reception",
"connections": {
"north": "hall"
},
@@ -73,7 +73,7 @@
]
},
"ceo": {
"type": "room_ceo2",
"type": "room_ceo",
"locked": true,
"lockType": "key",
"requires": "ceo_key",

View File

@@ -3,7 +3,7 @@
"startRoom": "reception",
"rooms": {
"reception": {
"type": "room_reception2",
"type": "room_reception",
"connections": {
"north": "hub"
},
@@ -24,7 +24,7 @@
]
},
"hub": {
"type": "room_office2",
"type": "room_office",
"locked": true,
"lockType": "key",
"requires": "hub_key",
@@ -61,7 +61,7 @@
]
},
"server1": {
"type": "room_servers2",
"type": "room_servers",
"locked": true,
"lockType": "key",
"requires": "server1_key",
@@ -79,7 +79,7 @@
]
},
"server2": {
"type": "room_servers2",
"type": "room_servers",
"locked": true,
"lockType": "key",
"requires": "server2_key",
@@ -97,7 +97,7 @@
]
},
"server3": {
"type": "room_servers2",
"type": "room_servers",
"locked": true,
"lockType": "key",
"requires": "server3_key",

View File

@@ -3,7 +3,7 @@
"startRoom": "reception",
"rooms": {
"reception": {
"type": "room_reception2",
"type": "room_reception",
"connections": {
"north": ["office1", "office2"]
},
@@ -24,7 +24,7 @@
]
},
"office1": {
"type": "room_office2",
"type": "room_office",
"locked": true,
"lockType": "key",
"requires": "office1_key",
@@ -42,7 +42,7 @@
]
},
"office2": {
"type": "room_office2",
"type": "room_office",
"connections": {
"south": "reception",
"north": "ceo"
@@ -58,7 +58,7 @@
]
},
"ceo": {
"type": "room_ceo2",
"type": "room_ceo",
"locked": true,
"lockType": "key",
"requires": "ceo_key",