diff --git a/client/scripts/autoloads/audio_manager.gd b/client/scripts/autoloads/audio_manager.gd index a71ba9406..c8a368250 100644 --- a/client/scripts/autoloads/audio_manager.gd +++ b/client/scripts/autoloads/audio_manager.gd @@ -231,7 +231,8 @@ func play_sound_event(event_type: String, world_tile_pos: Vector2) -> void: var asset_key: String = SOUND_EVENT_ASSETS.get(event_type, "") if asset_key.is_empty(): return - play_at(asset_key, world_tile_pos * Constants.TILE_SIZE) + var C := load("res://scripts/constants.gd") + play_at(asset_key, world_tile_pos * C.TILE_SIZE) # --- Playback: spatial (D-018 close-range) --- diff --git a/client/scripts/autoloads/input_mapper.gd b/client/scripts/autoloads/input_mapper.gd index eb4f7cf6e..5163386fa 100644 --- a/client/scripts/autoloads/input_mapper.gd +++ b/client/scripts/autoloads/input_mapper.gd @@ -184,10 +184,11 @@ func _update_facing_from_mouse() -> void: if vp == null: return var canvas_xf := vp.get_canvas_transform() - var player_world_px := GameState.player_position * Constants.TILE_SIZE - var player_screen := canvas_xf * player_world_px - var mouse_screen := vp.get_mouse_position() - var delta := mouse_screen - player_screen + var C := load("res://scripts/constants.gd") + var player_world_px: Vector2 = GameState.player_position * C.TILE_SIZE + var player_screen: Vector2 = canvas_xf * player_world_px + var mouse_screen: Vector2 = vp.get_mouse_position() + var delta: Vector2 = mouse_screen - player_screen # Only update if mouse is meaningfully distant from player (avoid jitter at center) if delta.length_squared() > 4.0: facing_angle = delta.angle() diff --git a/client/scripts/autoloads/sim_bridge.gd b/client/scripts/autoloads/sim_bridge.gd index 36e454c92..d751049a3 100644 --- a/client/scripts/autoloads/sim_bridge.gd +++ b/client/scripts/autoloads/sim_bridge.gd @@ -27,8 +27,8 @@ var _last_snapshot: Variant = null # Most recent decoded snapshot (consumed by var _outbound_buffer: Array[Dictionary] = [] # Raw inputs awaiting batch encode + transport # Transport layer (non-test mode) -var _bridge: LocalBridge = null -var _server: ServerProcess = null +var _bridge = null # LocalBridge +var _server = null # ServerProcess var _connect_retries: int = 0 var _retry_timer: float = 0.0 var _handshake_start_usec: int = 0 @@ -126,7 +126,8 @@ func connect_to_sim() -> void: # Spawn server subprocess if not server_path.is_empty(): - _server = ServerProcess.new() + var SP := load("res://scripts/protocol/server_process.gd") + _server = SP.new() # Server reads first positional arg as bind address (e.g. "127.0.0.1:9876"). # D-085 (#258): pass --game-id so server logs use the same session identifier. var args := ["127.0.0.1:" + str(server_port)] @@ -159,7 +160,8 @@ func disconnect_from_sim() -> void: # Attempt TCP connection. Called from _process() during CONNECTING state. func _try_connect() -> void: - _bridge = LocalBridge.new() + var LB := load("res://scripts/protocol/local_bridge.gd") + _bridge = LB.new() var err := _bridge.connect_to_server("127.0.0.1", server_port) if err != OK: push_warning( diff --git a/client/tests/test_examine_display_sprint18.gd b/client/tests/test_examine_display_sprint18.gd index d5479e9d3..3edfc99c2 100644 --- a/client/tests/test_examine_display_sprint18.gd +++ b/client/tests/test_examine_display_sprint18.gd @@ -52,7 +52,7 @@ func after_test() -> void: # --------------------------------------------------------------------------- func test_gamestate_examine_result_field_exists() -> void: - assert_bool(GameState.has("current_examine_result")).override_failure_message( + assert_bool("current_examine_result" in GameState).override_failure_message( "GameState must have 'current_examine_result' field (#174)" ).is_true() diff --git a/client/tests/test_fog_sprint22.gd b/client/tests/test_fog_sprint22.gd index 3f9849186..4478a171d 100644 --- a/client/tests/test_fog_sprint22.gd +++ b/client/tests/test_fog_sprint22.gd @@ -25,6 +25,7 @@ func _reset_fog_state(fog_state: Node) -> void: GameState.boundary_positions.clear() GameState.visible_tiles.clear() GameState.visibility_sectors.clear() + # 32x32 is an arbitrary test fixture size — not a production assumption. fog_state._resize(Rect2i(0, 0, 32, 32)) @@ -220,7 +221,8 @@ func test_exploration_data_preserved_across_resize() -> void: GameState.visible_positions = {Vector2i(3, 3): true} fog_state.update_from_state() - # Force a resize by moving far away + # Move far enough to trigger a resize: _grow_bounds_from_positions adds 8-tile padding, + # so (25,25) expands the bounds beyond the 32x32 fixture set in _reset_fog_state. GameState.visible_positions = {Vector2i(25, 25): true} fog_state.update_from_state() @@ -250,7 +252,8 @@ func test_newly_added_area_starts_unexplored_after_resize() -> void: GameState.visible_positions = {Vector2i(2, 2): true} fog_state.update_from_state() - # Move far away to trigger bounds growth + # Move far enough to trigger a resize: _grow_bounds_from_positions adds 8-tile padding, + # so (30,30) expands the bounds beyond the 32x32 fixture set in _reset_fog_state. GameState.visible_positions = {Vector2i(30, 30): true} fog_state.update_from_state() diff --git a/client/tests/test_game_state_sprint20.gd b/client/tests/test_game_state_sprint20.gd index 8aa22c060..7b4aab108 100644 --- a/client/tests/test_game_state_sprint20.gd +++ b/client/tests/test_game_state_sprint20.gd @@ -12,7 +12,7 @@ class_name TestGameStateSprint20 extends GdUnitTestSuite -func before_each() -> void: +func before_test() -> void: GameState.stationary_ticks = 0 SnapshotHandler._prev_player_position = Vector2(-1e9, -1e9) GameState.current_zone_id = "" diff --git a/client/ui/dialogue_box.gd b/client/ui/dialogue_box.gd index 292a00758..ff77cc54d 100644 --- a/client/ui/dialogue_box.gd +++ b/client/ui/dialogue_box.gd @@ -498,7 +498,7 @@ func _start_confrontation_beat(response_id: String, text: String) -> void: if _active_tween and _active_tween.is_valid(): _active_tween.kill() _active_tween = create_tween() - if _active_tween and _active_tween.is_valid() and is_instance_valid(panel): + if is_instance_valid(panel): _active_tween.tween_property(panel, "modulate:a", CONFRONTATION_DIM_ALPHA, 0.2) confrontation_monologue.emit(