Let daemon gameplay state close the main menu

This commit is contained in:
Meta Vens 2026-07-20 05:22:39 +01:00
commit ab6face8e2
4 changed files with 16 additions and 3 deletions

View file

@ -1935,8 +1935,13 @@ static async Task PublishClientGameplayDocumentsAsync(
var mainMenuState = await node.MutableDocument<AetheriaMainMenuState>(AetheriaStateNode.MainMenuStateKey)
.ReadAsync()
.ConfigureAwait(false);
var hasActivePilot = !string.IsNullOrWhiteSpace(result.Frame.Run?.CurrentEntityKey) &&
result.Frame.Run.Zones?.Any(zone =>
zone != null &&
zone.ZoneIndex == result.Frame.Run.CurrentZoneIndex &&
(zone.Entities?.Count ?? 0) > 0) == true;
var activeMainMenuSurfaceId = string.IsNullOrWhiteSpace(mainMenuState?.ActiveSurfaceId)
? AetheriaRuntimeMainMenuCommands.RootSurfaceId
? (hasActivePilot ? "" : AetheriaRuntimeMainMenuCommands.RootSurfaceId)
: mainMenuState.ActiveSurfaceId;
var reactiveGameSurface = AetheriaRuntimeSurfaceDocuments.ToPortableSurface(
AetheriaRuntimeDaemonGameSurfaceBuilder.BuildReactiveGameplay(