fix(client): address PR #36 review — 10 items from Hoshe + Tyre
Critical: - deactivate_insert() now called when selecting non-Insert spoke, cancelling with no selection, or pressing Escape while insert is active. Fixes simulation staying paused permanently after Insert. Warnings: - Checklist conditions with empty id excluded from get_results() and get_total_count() — prevents impossible-to-complete checklists. Warns at load time when empty-id conditions are found. - _content_base now checks res://content/ first (exported builds), falls back to ../content for editor/dev mode. - 26 new tests for D-054 functions: _angle_to_octant (8 octants), _snap_to_octant_dir (9 cases incl. zero/tiny), _wasd_to_world_dir (8 facing/movement combos). New test file: test_input_mapper_facing.gd. Suggestions: - Cached get_theme_default_font() in checklist overlay _ready(). - Documented InputMapper → GameState coupling as intentional. - Documented YAML parser # truncation limitation. - _insert_active reset on Escape dismiss (Tyre #3). - SimBridge test mode SetFacing reads action_data.facing instead of InputMapper global (Tyre #4). - Removed dead _facing_to_rotation() from entity_renderer.gd (Tyre #5). - Fixed 2 failing facing indicator tests to use InputMapper.facing_angle instead of GameState.player_facing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,12 +20,14 @@ const MAX_DESC_CHARS := 52 # Truncate long descriptions
|
||||
|
||||
var _evaluator = null # ChecklistEvaluator instance
|
||||
var _last_room_id: Variant = null
|
||||
var _cached_font: Font = null # Cached to avoid per-frame theme lookup
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
visible = false
|
||||
_evaluator = _ChecklistEvaluator.new()
|
||||
_cached_font = get_theme_default_font()
|
||||
|
||||
|
||||
func update_from_state() -> void:
|
||||
@@ -59,7 +61,7 @@ func _draw() -> void:
|
||||
if _evaluator == null or not _evaluator.is_loaded():
|
||||
return
|
||||
|
||||
var font := get_theme_default_font()
|
||||
var font: Font = _cached_font if _cached_font else get_theme_default_font()
|
||||
var results: Array = _evaluator.get_results()
|
||||
if results.is_empty():
|
||||
return
|
||||
|
||||
@@ -4,7 +4,9 @@ extends Control
|
||||
## Insert-styled: geometric lines, thin spokes, nearly transparent.
|
||||
## Renders on InsertOverlay (CanvasLayer 10).
|
||||
## Drag-release for power users, click-click for newcomers.
|
||||
## Insert spoke sends Pause on activate, Pause again on close (toggle).
|
||||
## Insert spoke sends PauseSimulation on activate (#518/D-058).
|
||||
## Selecting any other spoke (or re-opening the radial) calls deactivate_insert()
|
||||
## which sends ResumeSimulation. Pause/resume are idempotent.
|
||||
|
||||
signal spoke_selected(spoke_name: String)
|
||||
|
||||
@@ -83,6 +85,15 @@ func _close_menu() -> void:
|
||||
visible = false
|
||||
|
||||
|
||||
# Handle Escape key to dismiss menu and deactivate insert if active.
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if _open and event.is_action_pressed("ui_cancel"):
|
||||
if _insert_active:
|
||||
deactivate_insert()
|
||||
_close_menu()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
|
||||
func _update_hover(mouse_pos: Vector2) -> void:
|
||||
var delta := mouse_pos - _origin
|
||||
var dist := delta.length()
|
||||
@@ -115,6 +126,13 @@ func _confirm_selection() -> void:
|
||||
|
||||
if _hovered_spoke == Spoke.INSERT:
|
||||
_activate_insert()
|
||||
elif _insert_active:
|
||||
# Selecting any non-Insert spoke closes the insert and resumes sim
|
||||
deactivate_insert()
|
||||
|
||||
elif _insert_active:
|
||||
# No spoke selected (cancelled) while insert active — close insert
|
||||
deactivate_insert()
|
||||
|
||||
_close_menu()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user