refactor(ui): HudGroups z-index model + gameplay occlusion (D-170)

Replaced visibility toggling with z-index layer management. Nothing
gets hidden — fullscreen apps render on top, gameplay stays underneath.
Supports future hybrid layouts (insert-mode map alongside gameplay).

Added gameplay_occluded signal: WorldRenderer skips tile/fog/entity
updates when a fullscreen implant app covers it. Prevents wasted
render work behind opaque overlays. Other renderers can connect to
the same signal.

Modes: GAMEPLAY (z=0), INSERT (z=10), FULLSCREEN (z=20), MODAL (z=30).
Star map uses app_changed signal to toggle its own visibility based
on whether its app is active.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 11:21:31 +02:00
co-authored by Claude Opus 4.6
parent 09e0c522bd
commit 2e01081de7
4 changed files with 125 additions and 75 deletions
+16 -8
View File
@@ -118,8 +118,9 @@ func _ready() -> void:
_info_panel.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(_info_panel)
# D-170: Register with HUD visibility groups
# D-170: Register with HUD layer groups
HudGroups.register(self, "implant/map/starchart")
HudGroups.app_changed.connect(_on_app_changed)
_load_data()
if _data_loaded:
@@ -135,20 +136,27 @@ func _process(_delta: float) -> void:
## Called from main.gd when insert state changes.
## Only force-hides when insert is inactive. Does NOT auto-show — star map is
## modal (player opens via toggle_visible()), not always-on like the minimap.
## Called from main.gd when insert state changes.
func set_insert_active(active: bool) -> void:
_insert_active = active
if not active:
visible = false
if not active and HudGroups.is_app_active("implant/map/starchart"):
HudGroups.close_app()
## Toggle visibility via HUD group system (D-170).
## Opens implant/map (hides gameplay) or closes it (returns to gameplay).
## Toggle via HUD layer system (D-170).
func toggle_visible() -> void:
HudGroups.toggle_app("implant/map/starchart")
if visible:
## Respond to app layer changes (D-170).
func _on_app_changed(app_path: String, mode: HudGroups.Mode) -> void:
if app_path != "implant/map/starchart":
return
if mode == HudGroups.Mode.FULLSCREEN or mode == HudGroups.Mode.INSERT:
visible = true
_dirty = true
else:
visible = false
## Return the currently selected system data, or empty dict.