Files
settled-reach/client/ui/hud.gd
T
jpmschweitzerandClaude Opus 4.6 26a63d3899 feat(ui): convert HUD status, stance, interaction prompt to implant theme (D-169)
- HUD: programmatically builds ImplantPanel with health/mode/time rows,
  replaces raw MarginContainer/VBoxContainer/Labels
- Stance indicator: ImplantPanel with color-coded ImplantDataRow,
  replaces custom _draw() with hardcoded bg/text
- Interaction prompt: applies implant theme StyleBox + colors to
  existing PanelContainer layout

Minimap left as-is — its circular frame is a distinct diegetic element,
not rectangular panel chrome.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 12:25:33 +02:00

60 lines
1.7 KiB
GDScript

extends Control
## HUD — implant-styled status panel (D-169, D-170).
## Displays health, perception mode, time in an ImplantPanel.
var _panel: ImplantPanel
var _health_row: ImplantDataRow
var _perception_row: ImplantDataRow
var _time_row: ImplantDataRow
var _theme: ImplantTheme
func _ready() -> void:
# Remove the old raw MarginContainer/labels if present
var old := get_node_or_null("MarginContainer")
if old:
old.queue_free()
_theme = load("res://ui/implant/default_implant.tres") as ImplantTheme
_panel = ImplantPanel.new()
_panel.name = "StatusPanel"
_panel.theme_resource = _theme
_panel.custom_minimum_size.x = 200.0
_panel.size.x = 200.0
_panel.mouse_filter = Control.MOUSE_FILTER_IGNORE
_panel.position = Vector2(16, 16)
add_child(_panel)
_panel.move_child(_panel.get_node("Content"), 0) # ensure content is first
_health_row = ImplantDataRow.new("Health: 100")
_perception_row = ImplantDataRow.new("Mode: Baseline")
_time_row = ImplantDataRow.new("Time: 08:00")
_panel.add_component(_health_row)
_panel.add_component(_perception_row)
_panel.add_component(_time_row)
print("HUD: Initialized")
func update_from_hud_data(data: Dictionary) -> void:
if data.has("perception_mode"):
var prefix := UIStrings.get_text("hud.perception_mode_prefix")
if prefix.is_empty():
_perception_row.text = data.perception_mode.capitalize()
else:
_perception_row.text = prefix + ": " + data.perception_mode.capitalize()
if data.has("time"):
var prefix := UIStrings.get_text("hud.time_prefix")
if prefix.is_empty():
_time_row.text = data.time
else:
_time_row.text = prefix + ": " + data.time
func update_health(health: int) -> void:
_health_row.text = UIStrings.get_text("hud.health") + ": " + str(health)