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>
This commit is contained in:
@@ -9,40 +9,26 @@ enum Action {
|
||||
var input_queue: Array[Dictionary] = []
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
# Only process key press events (not releases or repeats)
|
||||
if not event is InputEventKey:
|
||||
return
|
||||
if not event.pressed or event.echo:
|
||||
return
|
||||
|
||||
var action: Action = -1
|
||||
var action_name: String = ""
|
||||
|
||||
# Map input actions to semantic Action enum
|
||||
# is_action_pressed handles press detection for all input types (key, gamepad, etc.)
|
||||
if event.is_action_pressed("move_north"):
|
||||
action = Action.MOVE_NORTH
|
||||
action_name = "move_north"
|
||||
elif event.is_action_pressed("move_south"):
|
||||
action = Action.MOVE_SOUTH
|
||||
action_name = "move_south"
|
||||
elif event.is_action_pressed("move_east"):
|
||||
action = Action.MOVE_EAST
|
||||
action_name = "move_east"
|
||||
elif event.is_action_pressed("move_west"):
|
||||
action = Action.MOVE_WEST
|
||||
action_name = "move_west"
|
||||
elif event.is_action_pressed("interact"):
|
||||
action = Action.INTERACT
|
||||
action_name = "interact"
|
||||
elif event.is_action_pressed("perception_mode"):
|
||||
action = Action.USE_PERCEPTION_MODE
|
||||
action_name = "perception_mode"
|
||||
elif event.is_action_pressed("open_menu"):
|
||||
action = Action.OPEN_MENU
|
||||
action_name = "open_menu"
|
||||
elif event.is_action_pressed("pause"):
|
||||
action = Action.PAUSE
|
||||
action_name = "pause"
|
||||
|
||||
# Queue the action if valid
|
||||
if action != -1:
|
||||
|
||||
Reference in New Issue
Block a user