HUD: merge TimeDisplay into ImplantPanel (time/health/perception in one panel), remove dead tscn nodes, move HUD to InsertOverlay for D-051 bloom. Interaction prompt: convert from PanelContainer+StyleBoxFlat to Control with ImplantPanel+ImplantDataRow, fix panel height for 42px minimum. Tests updated for new scene structure and public API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+20
-3
@@ -1,9 +1,10 @@
|
||||
extends Control
|
||||
|
||||
## HUD — implant-styled status panel (D-169, D-170).
|
||||
## Displays health and perception mode. Time is handled by TimeDisplay.
|
||||
## Merged panel: Time, Health, Perception mode. Time row replaces standalone TimeDisplay (#786).
|
||||
|
||||
var _panel: ImplantPanel
|
||||
var _time_row: ImplantDataRow
|
||||
var _health_row: ImplantDataRow
|
||||
var _perception_row: ImplantDataRow
|
||||
|
||||
@@ -22,13 +23,14 @@ func _ready() -> void:
|
||||
_panel.custom_minimum_size.x = 200.0
|
||||
_panel.size.x = 200.0
|
||||
_panel.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
_panel.position = Vector2(16, 80) # below TimeDisplay (occupies 16-70)
|
||||
_panel.position = Vector2(16, 16) # top-left; replaces standalone TimeDisplay
|
||||
add_child(_panel)
|
||||
_panel.move_child(_panel.get_node("Content"), 0)
|
||||
|
||||
_time_row = ImplantDataRow.new("--:--")
|
||||
_health_row = ImplantDataRow.new("Health: 100")
|
||||
_perception_row = ImplantDataRow.new("Mode: Baseline")
|
||||
|
||||
_panel.add_component(_time_row)
|
||||
_panel.add_component(_health_row)
|
||||
_panel.add_component(_perception_row)
|
||||
|
||||
@@ -46,3 +48,18 @@ func update_from_hud_data(data: Dictionary) -> void:
|
||||
|
||||
func update_health(health: int) -> void:
|
||||
_health_row.text = UIStrings.get_text("hud.health") + ": " + str(health)
|
||||
|
||||
|
||||
func update_from_state() -> void:
|
||||
var gt: Dictionary = GameState.game_time
|
||||
if gt.is_empty():
|
||||
return
|
||||
var tod: int = int(gt.get("time_of_day", 0))
|
||||
var day: int = int(gt.get("day", 0))
|
||||
var phase: String = str(gt.get("day_phase", ""))
|
||||
_time_row.text = "%s · %s · D%d" % [Constants.format_game_time(tod), phase, day + 1]
|
||||
|
||||
|
||||
## Returns the time row text. Used by tests after standalone TimeDisplay was removed.
|
||||
func get_time_text() -> String:
|
||||
return _time_row.text if _time_row else "--:--"
|
||||
|
||||
Reference in New Issue
Block a user