Files
settled-reach/client/scripts/autoloads/game_state.gd
T
jpmschweitzerandClaude Opus 4.6 3368231396 fix(client): address PR review — input bug, bounds checks, fixture tests
- Fix input_mapper double-check bug (redundant InputEventKey + pressed filter)
- Add bounds checking for position arrays in entity_renderer and game_state
- Make test snapshot deterministic (incrementing counter, not wall clock)
- Fix tween overlap in monologue_display (cancel active tween before new one)
- Extract TILE_SIZE constant from magic number 32
- Add 5 D-030 Layer 1 fixture tests for snapshot parsing (7/7 total passing)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 17:53:24 +01:00

32 lines
832 B
GDScript

extends Node
# Updated each frame from ObserverSnapshot data
var current_snapshot: Dictionary = {}
var player_position: Vector2 = Vector2.ZERO
var visible_entities: Array = []
var fog_state: Dictionary = {}
var hud_data: Dictionary = {}
func apply_snapshot(snapshot: Dictionary) -> void:
current_snapshot = snapshot
# Parse player data
if snapshot.has("player") and snapshot.player.has("position"):
var pos = snapshot.player.position
if pos is Array and pos.size() >= 2:
player_position = Vector2(pos[0], pos[1])
else:
push_warning("GameState: malformed player position in snapshot")
# Parse entities
if snapshot.has("entities"):
visible_entities = snapshot.entities
# Parse fog state
if snapshot.has("fog"):
fog_state = snapshot.fog
# Parse HUD data
if snapshot.has("hud"):
hud_data = snapshot.hud