diff --git a/client/scripts/autoloads/hud_groups.gd b/client/scripts/autoloads/hud_groups.gd index a89b940a9..d199dd74a 100644 --- a/client/scripts/autoloads/hud_groups.gd +++ b/client/scripts/autoloads/hud_groups.gd @@ -61,6 +61,9 @@ func unregister(node: CanvasItem, group: String) -> void: ## Open an implant app in fullscreen (default) or insert mode. func open_app(app: String, mode: Mode = Mode.FULLSCREEN) -> void: + # Capture occlusion state BEFORE mutating — used for change detection below + var was_occluded := _active_mode == Mode.FULLSCREEN and not _active_app.is_empty() + # Close previous app if different if not _active_app.is_empty() and _active_app != app: _set_group_z(_active_app, Z_GAMEPLAY) @@ -70,7 +73,6 @@ func open_app(app: String, mode: Mode = Mode.FULLSCREEN) -> void: _active_mode = mode # Set z-levels based on mode - var was_occluded := _active_mode == Mode.FULLSCREEN and not _active_app.is_empty() if mode == Mode.FULLSCREEN: _set_group_z("gameplay", Z_GAMEPLAY) _set_group_z(app, Z_FULLSCREEN)