fix(client): decode tile_kind and fix entity alignment (#412)

Protocol decoder now reads tile_kind from VisibleTile and maps it to
the client's tile type string (floor/wall/door/object). GameState
falls back to visible_tiles when the test-mode tiles array is absent,
enabling live server tile rendering.

Fix entity-to-tile alignment: server sends tile-center render coords
(tile 16 -> 16.5) but entity renderer was using raw floats, placing
entities half a tile off. Now floors the coords to get the tile index.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 02:07:29 +01:00
co-authored by Claude Opus 4.6
parent 29c5003403
commit ea9cf554c6
3 changed files with 19 additions and 4 deletions
+4 -3
View File
@@ -71,11 +71,12 @@ func _update_entity_node(entity_id: int, entity_data: Dictionary) -> void:
var entity_node = entity_nodes[entity_id]
# Update position from x, y fields (Protocol format), centered within tile
# Update position from x, y fields (Protocol format), centered within tile.
# Server sends tile-center coords (tile 16 → 16.5), floor to get tile index.
if entity_data.has("x") and entity_data.has("y"):
entity_node.position = Vector2(
entity_data.x * TILE_SIZE + ENTITY_OFFSET,
entity_data.y * TILE_SIZE + ENTITY_OFFSET
floorf(entity_data.x) * TILE_SIZE + ENTITY_OFFSET,
floorf(entity_data.y) * TILE_SIZE + ENTITY_OFFSET
)
# v2: Peripheral vision dimming (D-015)