Complete the Hangar to Terminus runtime path

This commit is contained in:
Meta Vens 2026-08-08 09:31:24 +01:00
commit 56a156ee87
9 changed files with 106 additions and 17 deletions

View file

@ -174,8 +174,12 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
template = node.MutableDocument<AetheriaLoadoutTemplate>(new CultRecordKey(ship.LoadoutTemplateKey))
.ReadAsync().GetAwaiter().GetResult()!;
var surface = AetheriaRuntimeHangarSurfaceBuilder.Build(
hangar, ship.ShipId, AetheriaGameModes.Terminus, "2026-08-08T00:00:01Z", 1, template, runtimeCatalog);
hangar, ship.ShipId, AetheriaGameModes.Terminus, "2026-08-08T00:00:01Z", 1,
AetheriaRuntimeStateMapper.ToRuntimeLoadoutTemplate(template), runtimeCatalog);
var world = surface.Surface.Root.Children.Single(component => component.Kind == "world.scene3d");
Require(surface.Surface.Id == AetheriaRuntimeHangarCommands.SurfaceId &&
world.Props.Any(prop => prop.Key == "entityViewPointerId" && !string.IsNullOrWhiteSpace(prop.Value)) &&
world.Props.Any(prop => prop.Key == "entityBodyId" && !string.IsNullOrWhiteSpace(prop.Value)) &&
surface.Commands.Any(command => command.Command == AetheriaRuntimeHangarCommands.EquipItem) &&
surface.Commands.Any(command => command.Command == AetheriaRuntimeHangarCommands.RemoveItem) &&
surface.Commands.Any(command => command.Command == AetheriaRuntimeHangarCommands.Launch) &&

View file

@ -502,7 +502,7 @@ static async Task<AetheriaRuntimeDaemonTickResult> TickAsync(
publishTopology: true).ConfigureAwait(false);
await PublishSecondaryTopologyDocumentsAsync(node, options, result).ConfigureAwait(false);
TracePhase("api-publication");
await PublishStateSurfacesAsync(node, options, result.Frame.PublishedAtUtc).ConfigureAwait(false);
await PublishStateSurfacesAsync(node, options, result.Frame.PublishedAtUtc, publishHangar: false).ConfigureAwait(false);
TracePhase("state-surfaces");
await PublishOdinSurfaceAnnouncementsAsync(node, options, result.Frame.PublishedAtUtc).ConfigureAwait(false);
TracePhase("odin-announcements");
@ -603,7 +603,7 @@ static async Task PersistPreparedDocumentsAsync(
if (initialTopology)
{
await PublishSecondaryTopologyDocumentsAsync(node, options, prepared.Publication).ConfigureAwait(false);
await PublishStateSurfacesAsync(node, options, prepared.Publication.Frame.PublishedAtUtc).ConfigureAwait(false);
await PublishStateSurfacesAsync(node, options, prepared.Publication.Frame.PublishedAtUtc, publishHangar: false).ConfigureAwait(false);
await PublishOdinSurfaceAnnouncementsAsync(node, options, prepared.Publication.Frame.PublishedAtUtc).ConfigureAwait(false);
}
else
@ -2706,7 +2706,8 @@ static async Task AcceptEveCommandsAsync(
static async Task PublishStateSurfacesAsync(
AetheriaStateNode node,
AetheriaDaemonHostOptions options,
string updatedAtUtc)
string updatedAtUtc,
bool publishHangar = true)
{
var verseHost = await EnsureVerseHostSettingsAsync(node, options, updatedAtUtc).ConfigureAwait(false);
var eveStatus = await node.MutableDocument<AetheriaEveCommandAcceptanceStatus>(AetheriaStateNode.EveCommandAcceptanceStatusKey).ReadAsync().ConfigureAwait(false);
@ -2732,7 +2733,7 @@ static async Task PublishStateSurfacesAsync(
await node.MutableDocument<EveProviderAdvertisementDocument>(AetheriaStateNode.ProviderAdvertisementSurfaceKey)
.ReplaceAsync(AetheriaEveSurfaceDocuments.BuildProviderAdvertisement(verseHost, node.StatePath, updatedAtUtc))
.ConfigureAwait(false);
if (hangar != null)
if (publishHangar && hangar != null)
await node.MutableDocument<EveSurfaceDocument>(AetheriaRuntimeVerseRecordKeys.HangarSurface)
.ReplaceAsync(AetheriaRuntimeSurfaceDocuments.ToPortableSurface(
AetheriaRuntimeHangarSurfaceBuilder.Build(
@ -2741,7 +2742,7 @@ static async Task PublishStateSurfacesAsync(
AetheriaGameModes.Terminus,
updatedAtUtc,
Math.Max(1, hangar.Revision),
hangarLoadout,
hangarLoadout == null ? null : AetheriaRuntimeStateMapper.ToRuntimeLoadoutTemplate(hangarLoadout),
node.RuntimeCatalog().Latest())))
.ConfigureAwait(false);
await node.FlushAsync().ConfigureAwait(false);
@ -3199,7 +3200,12 @@ static async Task PublishRuntimeSessionAsync(
Status = status
})
.ConfigureAwait(false);
await PublishStateSurfacesAsync(node, options, now).ConfigureAwait(false);
await PublishStateSurfacesAsync(
node,
options,
now,
publishHangar: !string.Equals(status, "running", StringComparison.Ordinal) &&
!string.Equals(status, "completed", StringComparison.Ordinal)).ConfigureAwait(false);
}
static async Task EnsureWorldDocumentAsync(AetheriaStateNode node)

View file

@ -67,6 +67,18 @@ public static class AetheriaRuntimeStateMapper
};
}
public static AetheriaRuntimeLoadoutTemplateCommit ToRuntimeLoadoutTemplate(
AetheriaLoadoutTemplate loadout)
{
if (loadout == null) throw new ArgumentNullException(nameof(loadout));
return new AetheriaRuntimeLoadoutTemplateCommit
{
Name = loadout.Name,
OwnerPlayerKey = loadout.OwnerPlayerKey,
RootEntity = ToRuntimeEntityLoadout(loadout.RootEntity)
};
}
public static CultRecordKey LoadoutKey(string name)
{
return new CultRecordKey($"global:aetheria.loadout_template.{StableToken(name)}.v1");
@ -94,6 +106,47 @@ public static class AetheriaRuntimeStateMapper
};
}
private static AetheriaRuntimeEntityLoadoutCommit ToRuntimeEntityLoadout(AetheriaEntityLoadout entity) => new()
{
Name = entity.Name,
Kind = entity.Kind,
FactionKey = entity.FactionKey,
Hull = ToRuntimeLoadoutItem(entity.Hull),
Equipment = (entity.Equipment ?? []).Select(ToRuntimeItemSlot).ToArray(),
CargoBays = (entity.CargoBays ?? []).Select(ToRuntimeItemSlot).ToArray(),
DockingBays = (entity.DockingBays ?? []).Select(ToRuntimeItemSlot).ToArray(),
CargoContents = (entity.CargoContents ?? []).Select(value => new AetheriaRuntimeCargoBayLoadoutCommit
{
Items = (value.Items ?? []).Select(ToRuntimeItemSlot).ToArray()
}).ToArray(),
DockingBayContents = (entity.DockingBayContents ?? []).Select(value => new AetheriaRuntimeCargoBayLoadoutCommit
{
Items = (value.Items ?? []).Select(ToRuntimeItemSlot).ToArray()
}).ToArray(),
DockingBayAssignments = (entity.DockingBayAssignments ?? []).ToArray(),
WeaponGroups = (entity.WeaponGroups ?? []).Select(value => (IReadOnlyList<int>)(value ?? []).ToArray()).ToArray(),
Children = (entity.Children ?? []).Select(ToRuntimeEntityLoadout).ToArray()
};
private static AetheriaRuntimeLoadoutItemSlotCommit ToRuntimeItemSlot(AetheriaLoadoutItemSlot slot) => new()
{
X = slot.Position?.X ?? 0,
Y = slot.Position?.Y ?? 0,
Rotation = slot.Rotation,
Item = ToRuntimeLoadoutItem(slot.Item)
};
private static AetheriaRuntimeLoadoutItemCommit ToRuntimeLoadoutItem(AetheriaLoadoutItem item) => new()
{
ItemKey = item.ItemKey,
Quality = item.Quality,
Durability = item.Durability,
Quantity = item.Quantity,
Enabled = item.Enabled,
OverrideShutdown = item.OverrideShutdown,
Temperature = item.Temperature
};
private static AetheriaLoadoutItem ToLoadoutItem(AetheriaRuntimeLoadoutItemCommit? item)
{
item ??= new AetheriaRuntimeLoadoutItemCommit();

View file

@ -20,7 +20,7 @@ public static class AetheriaUnityBuild
new[] { scenePath },
"Build/Windows/Aetheria.exe",
BuildTarget.StandaloneWindows64,
BuildOptions.Development);
BuildOptions.None);
if (report.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
throw new System.InvalidOperationException("Aetheria Unity build failed: " + report.summary.result);
}

View file

@ -11,6 +11,6 @@
"org.gamecult.eve.plugin-fields": "https://github.com/GameCult/EvePlugins.git?path=/plugins/eve-plugin-fields/unity/org.gamecult.eve.plugin-fields#eve-plugin-fields-unity-v0.2.3",
"org.gamecult.eve.surface": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.surface#eveunity-surface-v0.2.4",
"org.gamecult.eve.unity-scene": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.103",
"org.gamecult.eve.unity-uitoolkit": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#eveunity-uitoolkit-v0.1.2"
"org.gamecult.eve.unity-uitoolkit": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#befdd6a4a1f0376b40a3103aae811670336c0fee"
}
}

View file

@ -168,13 +168,13 @@
"hash": "050b2019bd6faa4275013516870d1ded245ee391"
},
"org.gamecult.eve.unity-uitoolkit": {
"version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#eveunity-uitoolkit-v0.1.2",
"version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#befdd6a4a1f0376b40a3103aae811670336c0fee",
"depth": 0,
"source": "git",
"dependencies": {
"org.gamecult.eve.surface": "0.2.4"
},
"hash": "44390549775ec535ee31fc60a5bc594f372f4147"
"hash": "befdd6a4a1f0376b40a3103aae811670336c0fee"
},
"com.unity.modules.assetbundle": {
"version": "1.0.0",

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Aetheria.State.Documents;
#nullable enable
@ -30,7 +29,7 @@ namespace GameCult.Aetheria.State.Verse
string selectedMode,
string updatedAtUtc,
long version = 1,
AetheriaLoadoutTemplate? loadout = null,
AetheriaRuntimeLoadoutTemplateCommit? loadout = null,
AetheriaRuntimeCatalogSnapshot? catalog = null)
{
if (hangar == null) throw new ArgumentNullException(nameof(hangar));
@ -40,7 +39,7 @@ namespace GameCult.Aetheria.State.Verse
var mode = AetheriaGameModes.IsKnown(selectedMode) ? selectedMode : AetheriaGameModes.Terminus;
var canLaunch = selected != null && loadout != null && string.Equals(selected.Status, AetheriaHangarShipStatuses.Available, StringComparison.Ordinal);
var canContinue = selected != null && string.Equals(selected.Status, AetheriaHangarShipStatuses.Deployed, StringComparison.Ordinal) && !string.IsNullOrWhiteSpace(selected.ActiveDeploymentId);
var equipment = loadout?.RootEntity?.Equipment ?? Array.Empty<AetheriaLoadoutItemSlot>();
var equipment = loadout?.RootEntity?.Equipment ?? Array.Empty<AetheriaRuntimeLoadoutItemSlotCommit>();
var inventory = hangar.Inventory ?? Array.Empty<AetheriaHangarItemStack>();
var root = Component(
@ -49,6 +48,16 @@ namespace GameCult.Aetheria.State.Verse
Props(("title", "HANGAR"), ("selectedMode", mode), ("hangarRevision", hangar.Revision.ToString(CultureInfo.InvariantCulture))),
new[]
{
Component("aetheria.hangar.world", "world.scene3d", Props(
("statePointerId", AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest.ToString()),
("entityViewPointerId", AetheriaRuntimeVerseRecordKeys.EveEntitySoaViewLatest.ToString()),
("entityViewSchema", GameCult.Eve.Surface.EveEntitySoaViewDocument.SchemaId),
("entityBodyId", AetheriaRuntimeDaemonSoaFramePublisher.BodyId),
("zoneRenderPointerId", AetheriaRuntimeVerseRecordKeys.ZoneRenderLatest.ToString()),
("zoneRenderSchema", AetheriaRuntimeDaemonSchemas.ZoneRender),
("assetManifest", AetheriaRuntimeVerseRecordKeys.EveAssetCatalog.ToString()),
("cameraRig", "hangar-static"),
("viewId", "aetheria.hangar")), Array.Empty<AetheriaRuntimeSurfaceComponent>()),
Panel("aetheria.hangar.ship_summary", "SHIP", selected == null
? new[] { Text("aetheria.hangar.ship.none", "No ship selected") }
: new[]
@ -75,7 +84,7 @@ namespace GameCult.Aetheria.State.Verse
Panel("aetheria.hangar.loadout", "LOADOUT", equipment.Select((slot, index) =>
Button(
$"aetheria.hangar.loadout.item.{index}",
$"{ItemName(catalog, slot.Item?.ItemKey)} [{slot.Position?.X ?? 0},{slot.Position?.Y ?? 0}] REMOVE",
$"{ItemName(catalog, slot.Item?.ItemKey)} [{slot.X},{slot.Y}] REMOVE",
AetheriaRuntimeHangarCommands.RemoveItem,
("shipId", selected?.ShipId ?? ""),
("equipmentIndex", index.ToString(CultureInfo.InvariantCulture)),
@ -159,7 +168,7 @@ namespace GameCult.Aetheria.State.Verse
Component(id, "text", Props(("value", value)), Array.Empty<AetheriaRuntimeSurfaceComponent>());
private static AetheriaRuntimeSurfaceComponent Button(string id, string label, string command, params (string Key, string Value)[] extra) =>
Component(id, "button", Props(new[] { ("label", label), ("command", command) }.Concat(extra).ToArray()), Array.Empty<AetheriaRuntimeSurfaceComponent>());
Component(id, "control.button", Props(new[] { ("label", label), ("command", command) }.Concat(extra).ToArray()), Array.Empty<AetheriaRuntimeSurfaceComponent>());
private static AetheriaRuntimeSurfaceCommandTemplate Command(string command, string label) =>
new AetheriaRuntimeSurfaceCommandTemplate(command, label, AetheriaRuntimeSurfaceCommandTemplate.CultMeshTransport);

View file

@ -1,6 +1,7 @@
param(
[string] $UnityExe = "C:\Program Files\Unity\Hub\Editor\6000.4.2f1\Editor\Unity.exe",
[int] $Port = 3076,
[string] $State = "",
[switch] $SkipBuild
)
@ -11,7 +12,11 @@ $artifacts = Join-Path $project "Build\Logs"
$clientExe = Join-Path $project "Build\Windows\Aetheria.exe"
$daemonProject = Join-Path $root "Aetheria.State.Daemon\Aetheria.State.Daemon.csproj"
$importProject = Join-Path $root "Aetheria.State.Import\Aetheria.State.Import.csproj"
$state = Join-Path $project "Build\aetheria-unity.cc"
$state = if ([string]::IsNullOrWhiteSpace($State)) {
Join-Path $project "Build\aetheria-unity.cc"
} else {
[System.IO.Path]::GetFullPath($State)
}
$stateRecords = "$state.records"
New-Item -ItemType Directory -Force $artifacts | Out-Null

View file

@ -22,6 +22,9 @@ $expected = @{
"org.gamecult.eve.unity-scene" = @(
"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.103",
"050b2019bd6faa4275013516870d1ded245ee391")
"org.gamecult.eve.unity-uitoolkit" = @(
"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#befdd6a4a1f0376b40a3103aae811670336c0fee",
"befdd6a4a1f0376b40a3103aae811670336c0fee")
}
foreach ($packageName in $expected.Keys) {
@ -114,6 +117,15 @@ foreach ($forbiddenInput in @("AetheriaRuntimeVerseSchemas", "AetheriaRuntimeVer
if ($bootstrapSource -match [regex]::Escape($forbiddenInput)) { throw "Client bootstrap depends on forbidden product input '$forbiddenInput'." }
}
$uiToolkitPackage = Get-ChildItem (Join-Path $ProjectPath "Library/PackageCache") -Directory |
Where-Object Name -Like "org.gamecult.eve.unity-uitoolkit@*" |
Select-Object -First 1
if (-not $uiToolkitPackage) { throw "Resolved Eve Unity UI Toolkit package is missing from Library/PackageCache." }
$uiToolkitLowererSource = Get-Content (Join-Path $uiToolkitPackage.FullName "Runtime/EveUiToolkitSurfaceLowerer.cs") -Raw
if ($uiToolkitLowererSource -notmatch 'unity-uitoolkit-.*Guid\.NewGuid') {
throw "Resolved Eve Unity UI Toolkit commands do not mint invocation-scoped idempotency keys."
}
$launcherSource = Get-Content (Join-Path (Split-Path $PSScriptRoot -Parent) "scripts/run-aetheria-unity.ps1") -Raw
if ($launcherSource -notmatch 'EVEUNITY_SURFACE_ID\s*=\s*"aetheria\.hangar"') {
throw "Released launcher must enter through the daemon-owned Hangar surface."