fix(client): address PR #11 review — type safety, perf, tests

Add Dictionary validation in game_state visible_tiles loop to prevent
crash on malformed data (Hoshe critical). Skip redundant modulate.a
writes (Hoshe suggestion). Add 3 tests: malformed visible_tiles,
facing rotation accuracy, v1 backward compatibility. Clarify D-033
Phase 1/Phase 2 comments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-12 01:07:02 +01:00
co-authored by Claude Opus 4.6
parent 30b028e85a
commit 64897a40b3
5 changed files with 68 additions and 5 deletions
+4 -4
View File
@@ -79,11 +79,11 @@ func _update_entity_node(entity_id: int, entity_data: Dictionary) -> void:
)
# v2: Peripheral vision dimming (D-015)
# null visibility (v1 backward compat) defaults to full alpha
var visibility: Variant = entity_data.get("visibility")
if visibility == "Peripheral":
entity_node.modulate.a = Constants.PERIPHERAL_ALPHA
else:
entity_node.modulate.a = 1.0
var target_alpha := Constants.PERIPHERAL_ALPHA if visibility == "Peripheral" else 1.0
if not is_equal_approx(entity_node.modulate.a, target_alpha):
entity_node.modulate.a = target_alpha
# v2: Update facing indicator rotation (player entity only)
if entity_id == GameState.player_entity_id: