From 0bfae0af37bd472c758ba98020f93dcd75bf54e7 Mon Sep 17 00:00:00 2001 From: Balloonpopper Date: Tue, 19 Apr 2022 20:53:29 +1000 Subject: [PATCH] fix: Enforce rooms being located at (0,0) --- .../game/core-scripts/esc/esc_room_manager.gd | 11 +++++++++++ game/rooms/room02/room02.tscn | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/escoria-core/game/core-scripts/esc/esc_room_manager.gd b/addons/escoria-core/game/core-scripts/esc/esc_room_manager.gd index f3cf55036..f4f6ab82d 100644 --- a/addons/escoria-core/game/core-scripts/esc/esc_room_manager.gd +++ b/addons/escoria-core/game/core-scripts/esc/esc_room_manager.gd @@ -178,6 +178,17 @@ func init_room(room: ESCRoom) -> void: if escoria.main.current_scene == null: escoria.main.set_scene(room) + # If the room node isn't at (0,0), the walk_stop function will offset the + # player by the same number of pixels when they're at the terrain edge and + # move them when it shouldn't. + if room.position != Vector2(0,0): + escoria.logger.report_errors( + "ESCRoomManager.init_room: Room node not at (0,0)", + [ + "The room node's coordinates must be (0,0) instead of %s." % room.position + ] + ) + _perform_script_events(room) diff --git a/game/rooms/room02/room02.tscn b/game/rooms/room02/room02.tscn index d1c16c78e..3dcc7737d 100644 --- a/game/rooms/room02/room02.tscn +++ b/game/rooms/room02/room02.tscn @@ -185,7 +185,6 @@ tracks/3/keys = { [sub_resource type="CapsuleShape2D" id=8] [node name="room2" type="Node2D"] -position = Vector2( -2, 0 ) script = ExtResource( 6 ) global_id = "room2" esc_script = "res://game/rooms/room02/esc/room02_bridge.esc"