fix(ui): address PR #115 review — 8 items
- Fix stale test path UILayer/HUD → InsertOverlay/HUD - Fix D-record citation D-051 → D-049 in main.tscn - Add null guards to hud.gd update methods (pre-_ready safety) - Minimap: dirty-flag queue_redraw instead of per-frame - Remove redundant _panel.size.x, debug print - Fix DebugOverlay/GauntletHUD positioning comments Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+6
-3
@@ -21,7 +21,6 @@ func _ready() -> void:
|
||||
_panel.name = "StatusPanel"
|
||||
_panel.theme_resource = theme_res
|
||||
_panel.custom_minimum_size.x = 200.0
|
||||
_panel.size.x = 200.0
|
||||
_panel.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
_panel.position = Vector2(16, 16) # top-left; replaces standalone TimeDisplay
|
||||
add_child(_panel)
|
||||
@@ -34,10 +33,10 @@ func _ready() -> void:
|
||||
_panel.add_component(_health_row)
|
||||
_panel.add_component(_perception_row)
|
||||
|
||||
print("HUD: Initialized")
|
||||
|
||||
|
||||
func update_from_hud_data(data: Dictionary) -> void:
|
||||
if not _perception_row:
|
||||
return
|
||||
if data.has("perception_mode"):
|
||||
var prefix := UIStrings.get_text("hud.perception_mode_prefix")
|
||||
if prefix.is_empty():
|
||||
@@ -47,10 +46,14 @@ func update_from_hud_data(data: Dictionary) -> void:
|
||||
|
||||
|
||||
func update_health(health: int) -> void:
|
||||
if not _health_row:
|
||||
return
|
||||
_health_row.text = UIStrings.get_text("hud.health") + ": " + str(health)
|
||||
|
||||
|
||||
func update_from_state() -> void:
|
||||
if not _time_row:
|
||||
return
|
||||
var gt: Dictionary = GameState.game_time
|
||||
if gt.is_empty():
|
||||
return
|
||||
|
||||
+17
-1
@@ -38,6 +38,11 @@ var _insert_active: bool = true
|
||||
# D-169: StyleBoxFlat matching ImplantPanel aesthetic — drawn as container frame behind the circle.
|
||||
var _container_style: StyleBoxFlat = null
|
||||
|
||||
# Dirty flag — only queue_redraw() when player position or POI list changes.
|
||||
var _dirty: bool = true
|
||||
var _last_player_pos: Vector2 = Vector2(INF, INF)
|
||||
var _last_poi_count: int = -1
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
@@ -57,7 +62,16 @@ func _init_container_style() -> void:
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if _insert_active:
|
||||
if not _insert_active:
|
||||
return
|
||||
var pos := GameState.player_position
|
||||
var poi_count := GameState.discovered_pois.size()
|
||||
if pos != _last_player_pos or poi_count != _last_poi_count:
|
||||
_last_player_pos = pos
|
||||
_last_poi_count = poi_count
|
||||
_dirty = true
|
||||
if _dirty:
|
||||
_dirty = false
|
||||
queue_redraw()
|
||||
|
||||
|
||||
@@ -66,6 +80,8 @@ func _process(_delta: float) -> void:
|
||||
func set_insert_active(active: bool) -> void:
|
||||
_insert_active = active
|
||||
visible = active
|
||||
if active:
|
||||
_dirty = true
|
||||
|
||||
|
||||
func _draw() -> void:
|
||||
|
||||
Reference in New Issue
Block a user