fix(client): address PR #54 review — 7 items across Hoshe and Tyre

Critical: DIALOGUE_MAX_WIDTH 1200 → 640 to match D-076 spec.
tile_renderer: clarify z = server floor level, not scene z_index.
Add z-filter unit test (tiles at z!=0 must be skipped).
Camera test: is_equal → distance check for float safety, convergence
test frames 40 → 120 for robustness at lower smoothing speeds.
Teleport: remove redundant first snap in _teleport_transition (the
camera block in _process handles it via _teleport_in_progress flag).
entity_renderer: document y-sort bottom-anchor migration path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-21 14:20:27 +01:00
co-authored by Claude Opus 4.6
parent 519483a0cc
commit c347f28cbd
6 changed files with 46 additions and 14 deletions
+5 -4
View File
@@ -100,8 +100,8 @@ func test_camera_converges_to_player_over_multiple_frames() -> void:
var target := GameState.player_position * Constants.TILE_SIZE
# Run 40 frames (~0.67s at 60fps) — well past convergence for any speed ≥ 2.0
for i in range(40):
# Run 120 frames (~2s at 60fps) — converges within 1px for any speed ≥ 2.0
for i in range(120):
_instance._process(0.016)
var camera: Camera2D = _instance.get_node("Camera2D")
@@ -123,8 +123,9 @@ func test_camera_stationary_player_no_drift() -> void:
for i in range(10):
_instance._process(0.016)
# Camera should still be at anchored position (target = same point)
assert_that(camera.global_position).is_equal(initial_pos)
# Camera should still be at anchored position (target = same point).
# Use distance check — lerp toward same point may introduce float rounding.
assert_that(camera.global_position.distance_to(initial_pos) < 0.01).is_true()
# --- Teleport snap ---
@@ -270,3 +270,34 @@ func test_entities_in_ysort_group() -> void:
add_child(_instance)
assert_that(_instance.get_node_or_null("World/FogGroup/YSortGroup/Entities")).is_not_null()
# -------------------------------------------------------------------------
# #71: Tilemap z-filter — FloorTiles only renders floor level 0
# -------------------------------------------------------------------------
func test_tile_renderer_skips_nonzero_z() -> void:
# #71: Tiles with z != 0 must be filtered out by update_tiles().
var scene := load("res://scenes/main.tscn")
_instance = scene.instantiate()
auto_free(_instance)
add_child(_instance)
var tile_renderer: TileMapLayer = _instance.get_node("World/FogGroup/FloorTiles")
assert_that(tile_renderer).is_not_null()
# Feed tiles at z=0 and z=1
var tiles: Array = [
{"x": 0, "y": 0, "z": 0, "type": "floor"},
{"x": 1, "y": 0, "z": 1, "type": "floor"},
{"x": 2, "y": 0, "z": 0, "type": "wall"},
{"x": 3, "y": 0, "z": 2, "type": "door"},
]
tile_renderer.update_tiles(tiles)
# z=0 tiles should be present
assert_that(tile_renderer.get_cell_source_id(Vector2i(0, 0))).is_not_equal(-1)
assert_that(tile_renderer.get_cell_source_id(Vector2i(2, 0))).is_not_equal(-1)
# z=1 and z=2 tiles should NOT be present (-1 = no cell)
assert_that(tile_renderer.get_cell_source_id(Vector2i(1, 0))).is_equal(-1)
assert_that(tile_renderer.get_cell_source_id(Vector2i(3, 0))).is_equal(-1)