Publish Starbridge worker roster through Eve
This commit is contained in:
parent
91c63c41bd
commit
11b3ddee5b
2 changed files with 68 additions and 0 deletions
|
|
@ -927,6 +927,18 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
"commander Eve surface must publish authoritative task status");
|
||||
Require(commander.Commands.Any(command => string.Equals(command.Command, "aetheria.daemon.issue_agent_task", StringComparison.Ordinal)),
|
||||
"commander Eve surface must advertise task issue command");
|
||||
var roster = Flatten(commander.Surface.Root)
|
||||
.Single(component => string.Equals(component.Kind, "agent.roster", StringComparison.Ordinal));
|
||||
var worker = Flatten(roster)
|
||||
.Single(component => string.Equals(component.Kind, "agent.item", StringComparison.Ordinal));
|
||||
Require(!string.IsNullOrWhiteSpace(worker.Props["entityId"]),
|
||||
"commander Eve roster must expose stable provider-owned worker identity");
|
||||
Require(worker.Props["capabilities"].Split(',').Contains(AetheriaRuntimeAgentTaskTypes.Explore),
|
||||
"commander Eve roster must expose provider-owned capability claims");
|
||||
RequireEqual("", worker.Props["assignedTaskId"],
|
||||
"completed worker assignment must be visible as released on the Eve roster");
|
||||
RequireEqual("false", worker.Props["controlled"],
|
||||
"commander Eve roster must distinguish autonomous workers from manual helm authority");
|
||||
}
|
||||
|
||||
private static void MultipleActorsUseTheSameMovementLever()
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
var root = SurfaceRoot(
|
||||
"aetheria.starbridge.commander.root",
|
||||
StrategicWorldSurface("aetheria.starbridge.commander.world", run, zone),
|
||||
BuildAgentRoster(run),
|
||||
BuildAgentTaskBoard(run),
|
||||
BuildSurveyKnowledge(run),
|
||||
BuildStarbridgeStationStockCard(starbridge),
|
||||
|
|
@ -213,6 +214,57 @@ namespace GameCult.Aetheria.State.Verse
|
|||
tasks);
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeSurfaceComponent BuildAgentRoster(AetheriaRuntimeRunCheckpointCommit run)
|
||||
{
|
||||
var agents = (run.Zones ?? Array.Empty<AetheriaRuntimeZoneSnapshotCommit>())
|
||||
.Where(zone => zone != null)
|
||||
.SelectMany(zone => (zone.Entities ?? Array.Empty<AetheriaRuntimeEntitySnapshotCommit>())
|
||||
.Where(entity => entity != null && (entity.AgentTaskCapabilities ?? Array.Empty<string>()).Count > 0)
|
||||
.Select(entity => (Zone: zone, Entity: entity)))
|
||||
.OrderBy(value => value.Entity.Name, StringComparer.Ordinal)
|
||||
.Select(value =>
|
||||
{
|
||||
var controlled = AetheriaRuntimeRunCheckpointCommit.TryParseEntityKey(
|
||||
run.CurrentEntityKey, out var controlledZone, out var controlledEntity) &&
|
||||
controlledZone == value.Zone.ZoneIndex && controlledEntity == value.Entity.EntityIndex;
|
||||
var home = FindEntityById(run, value.Entity.HomeEntityId);
|
||||
var atHome = home.Entity != null && home.Zone != null &&
|
||||
home.Zone.ZoneIndex == value.Zone.ZoneIndex &&
|
||||
(home.Entity.DockingBayAssignments ?? Array.Empty<int>()).Contains(value.Entity.EntityIndex);
|
||||
return Node(
|
||||
$"aetheria.starbridge.commander.agents.{SurfaceToken(value.Entity.EntityId)}",
|
||||
"agent.item",
|
||||
new[]
|
||||
{
|
||||
("label", value.Entity.Name),
|
||||
("entityId", value.Entity.EntityId),
|
||||
("zoneIndex", value.Zone.ZoneIndex.ToString(CultureInfo.InvariantCulture)),
|
||||
("entityIndex", value.Entity.EntityIndex.ToString(CultureInfo.InvariantCulture)),
|
||||
("capabilities", string.Join(",", value.Entity.AgentTaskCapabilities ?? Array.Empty<string>())),
|
||||
("assignedTaskId", value.Entity.AssignedAgentTaskId),
|
||||
("homeEntityId", value.Entity.HomeEntityId),
|
||||
("controlled", controlled ? "true" : "false"),
|
||||
("active", value.Entity.IsActive ? "true" : "false"),
|
||||
("atHome", atHome ? "true" : "false")
|
||||
});
|
||||
})
|
||||
.ToArray();
|
||||
return Node("aetheria.starbridge.commander.agents", "agent.roster", new[] { ("title", "Workers") }, agents);
|
||||
}
|
||||
|
||||
private static (AetheriaRuntimeZoneSnapshotCommit? Zone, AetheriaRuntimeEntitySnapshotCommit? Entity) FindEntityById(
|
||||
AetheriaRuntimeRunCheckpointCommit run,
|
||||
string entityId)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(entityId))
|
||||
return (null, null);
|
||||
foreach (var zone in run.Zones ?? Array.Empty<AetheriaRuntimeZoneSnapshotCommit>())
|
||||
foreach (var entity in zone?.Entities ?? Array.Empty<AetheriaRuntimeEntitySnapshotCommit>())
|
||||
if (entity != null && string.Equals(entity.EntityId, entityId, StringComparison.Ordinal))
|
||||
return (zone, entity);
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeSurfaceComponent FeedbackStream(AetheriaRuntimeRunCheckpointCommit run, long frameId)
|
||||
{
|
||||
var events = (run.GameEvents ?? Array.Empty<AetheriaRuntimeGameEventCommit>())
|
||||
|
|
@ -545,6 +597,10 @@ namespace GameCult.Aetheria.State.Verse
|
|||
["entityKind"] = entity.Kind ?? "",
|
||||
["label"] = string.IsNullOrWhiteSpace(entity.Name) ? entityId : entity.Name,
|
||||
["faction"] = entity.FactionKey ?? "",
|
||||
["providerEntityId"] = entity.EntityId ?? "",
|
||||
["homeEntityId"] = entity.HomeEntityId ?? "",
|
||||
["agentCapabilities"] = string.Join(",", entity.AgentTaskCapabilities ?? Array.Empty<string>()),
|
||||
["assignedTaskId"] = entity.AssignedAgentTaskId ?? "",
|
||||
["assetRef"] = PlayableWorldAssetRef(entity),
|
||||
["position"] = FormatPosition(entity),
|
||||
["rotationY"] = HeadingYaw(entity).ToString("0.###", CultureInfo.InvariantCulture),
|
||||
|
|
|
|||
Loading…
Reference in a new issue