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:
@@ -63,7 +63,7 @@ static func decode_snapshot(bytes: PackedByteArray) -> Variant:
|
||||
if raw_facing is String:
|
||||
player_facing = raw_facing
|
||||
|
||||
# visible_tiles: Array of {x, y, z, visibility}
|
||||
# visible_tiles: Array of {x, y, z, visibility, tile_kind}
|
||||
var visible_tiles: Array = []
|
||||
var raw_vtiles: Variant = raw.get("visible_tiles")
|
||||
if raw_vtiles is Array:
|
||||
@@ -77,6 +77,12 @@ static func decode_snapshot(bytes: PackedByteArray) -> Variant:
|
||||
var vis: Variant = raw_tile.get("visibility")
|
||||
if vis is String:
|
||||
tile_entry["visibility"] = vis
|
||||
# tile_kind: Floor/Wall/Door/Object — map to client tile type strings
|
||||
var kind: Variant = raw_tile.get("tile_kind")
|
||||
if kind is String:
|
||||
tile_entry["type"] = kind.to_lower()
|
||||
else:
|
||||
tile_entry["type"] = "floor"
|
||||
visible_tiles.append(tile_entry)
|
||||
|
||||
# v4: nearby_interactions (#404/#405)
|
||||
|
||||
Reference in New Issue
Block a user