Author canonical Starbridge workers
This commit is contained in:
parent
d79aef1053
commit
91c63c41bd
5 changed files with 57 additions and 11 deletions
|
|
@ -27,6 +27,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
SchedulerAssignsShortestGalaxyRoute();
|
||||
AgentTraversesGalaxyRouteBeforeExecutingTask();
|
||||
IdleAgentReturnsToCanonicalHomeAndDocks();
|
||||
ControlledShipDoesNotReceiveAutonomousHelmCommands();
|
||||
AttackAgentControlsOptimumRangeThroughMovementLever();
|
||||
AgentCompletesAttackTaskThroughTargetFireAndYmir();
|
||||
AgentCompletesHaulTaskThroughMovementAndCargoCommands();
|
||||
|
|
@ -53,7 +54,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
};
|
||||
var run = new AetheriaRuntimeRunCheckpointCommit
|
||||
{
|
||||
CurrentZoneIndex = 0, CurrentEntityKey = "zone.0.entity.0", Zones = [zone],
|
||||
CurrentZoneIndex = 0, CurrentEntityKey = "", Zones = [zone],
|
||||
AgentTasks = [new AetheriaRuntimeAgentTaskCommit { TaskId = "tow-1", CorporationKey = "workers", TaskType = AetheriaRuntimeAgentTaskTypes.Tow, ZoneIndex = 0, Status = AetheriaRuntimeAgentTaskStatuses.Queued, TargetEntityIndex = 1, OrbitParentKey = "parent-body", OrbitDistance = 20, CompletionRadius = 5 }]
|
||||
};
|
||||
AetheriaRuntimeDaemonTickRunner.Tick(Path.Combine(Path.GetTempPath(), "aetheria-tow-attach-smoke.cc"), run,
|
||||
|
|
@ -80,7 +81,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
var catalog = new AetheriaRuntimeCatalogSnapshot([scanner], [], []);
|
||||
var run = new AetheriaRuntimeRunCheckpointCommit
|
||||
{
|
||||
CurrentZoneIndex = 0, CurrentEntityKey = "zone.0.entity.0",
|
||||
CurrentZoneIndex = 0, CurrentEntityKey = "",
|
||||
Zones = [new AetheriaRuntimeZoneSnapshotCommit
|
||||
{
|
||||
ZoneIndex = 0, Entities = [surveyor],
|
||||
|
|
@ -156,7 +157,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
{
|
||||
GenerationSeed = 7,
|
||||
CurrentZoneIndex = 0,
|
||||
CurrentEntityKey = "zone.0.entity.0",
|
||||
CurrentEntityKey = "",
|
||||
Zones = [zone],
|
||||
AgentTasks = [new AetheriaRuntimeAgentTaskCommit { TaskId = "mine-1", CorporationKey = "workers", TaskType = AetheriaRuntimeAgentTaskTypes.Mine, ZoneIndex = 0, OriginEntityIndex = 1, CompletionRadius = 10, Status = AetheriaRuntimeAgentTaskStatuses.Queued, TargetBodyKeys = ["belt"] }]
|
||||
};
|
||||
|
|
@ -218,7 +219,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
{
|
||||
RunId = "behavior-query-smoke",
|
||||
CurrentZoneIndex = 0,
|
||||
CurrentEntityKey = "zone.0.entity.0",
|
||||
CurrentEntityKey = "",
|
||||
Zones = [new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [entity] }]
|
||||
};
|
||||
|
||||
|
|
@ -279,7 +280,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
{
|
||||
RunId = "agent-patrol-smoke",
|
||||
CurrentZoneIndex = 0,
|
||||
CurrentEntityKey = "zone.0.entity.0",
|
||||
CurrentEntityKey = "",
|
||||
Zones =
|
||||
[
|
||||
new AetheriaRuntimeZoneSnapshotCommit
|
||||
|
|
@ -403,7 +404,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
{
|
||||
RunId = "agent-haul-smoke",
|
||||
CurrentZoneIndex = 0,
|
||||
CurrentEntityKey = "zone.0.entity.1",
|
||||
CurrentEntityKey = "",
|
||||
Zones = [new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [origin, agent, destination] }]
|
||||
};
|
||||
var issue = AetheriaRuntimeDaemonCommandDocument.Create(
|
||||
|
|
@ -485,7 +486,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
{
|
||||
RunId = "agent-attack-smoke",
|
||||
CurrentZoneIndex = 0,
|
||||
CurrentEntityKey = "zone.0.entity.0",
|
||||
CurrentEntityKey = "",
|
||||
Zones = [new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [agent, target] }]
|
||||
};
|
||||
var issue = AetheriaRuntimeDaemonCommandDocument.Create(
|
||||
|
|
@ -827,6 +828,33 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
"docked worker must not emit a perpetual homecoming repair loop");
|
||||
}
|
||||
|
||||
private static void ControlledShipDoesNotReceiveAutonomousHelmCommands()
|
||||
{
|
||||
var controlled = Entity(0, 100, "workers");
|
||||
controlled.EntityId = "controlled-worker";
|
||||
controlled.HomeEntityId = "controlled-home";
|
||||
controlled.AgentTaskCapabilities = [AetheriaRuntimeAgentTaskTypes.Explore];
|
||||
var home = Entity(1, 0, "workers");
|
||||
home.EntityId = "controlled-home";
|
||||
home.Kind = "station";
|
||||
var task = AgentTask("controlled-task", 10);
|
||||
var run = new AetheriaRuntimeRunCheckpointCommit
|
||||
{
|
||||
RunId = "controlled-agent-authority-smoke",
|
||||
CurrentZoneIndex = 0,
|
||||
CurrentEntityKey = "zone.0.entity.0",
|
||||
Zones = [new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [controlled, home] }],
|
||||
AgentTasks = [task]
|
||||
};
|
||||
|
||||
var commands = AetheriaRuntimeAgentScheduler.AssignAndPlan(run, 1);
|
||||
|
||||
RequireEqual(AetheriaRuntimeAgentTaskStatuses.Queued, task.Status,
|
||||
"manual helm owner must not be conscripted into autonomous corporation work");
|
||||
Require(commands.Count == 0,
|
||||
"controlled ship must emit no task or return-home commands without delegated helm authority");
|
||||
}
|
||||
|
||||
private static void AgentClaimsAndCompletesExploreTaskThroughCommands()
|
||||
{
|
||||
var agent = Entity(0, 0, "workers");
|
||||
|
|
@ -835,7 +863,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
{
|
||||
RunId = "agent-task-smoke",
|
||||
CurrentZoneIndex = 0,
|
||||
CurrentEntityKey = "zone.0.entity.0",
|
||||
CurrentEntityKey = "",
|
||||
Zones = [new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [agent] }]
|
||||
};
|
||||
var issue = AetheriaRuntimeDaemonCommandDocument.Create(
|
||||
|
|
|
|||
|
|
@ -175,8 +175,8 @@ internal static class AetheriaDaemonZoneGenerator
|
|||
.Select(index => EntityKey(0, index))
|
||||
.ToArray();
|
||||
|
||||
return
|
||||
[
|
||||
var entities = new[]
|
||||
{
|
||||
Entity(loadouts, "Anchor Station", "station", -170, -80, 0, 0, "player", 760, keys[6], [keys[1], keys[2], keys[3], keys[4], keys[6], keys[7], keys[11]], ["repair-parts", "reactor-fuel", "drone-core"]),
|
||||
Entity(loadouts, "Vanguard One", "ship", -40, -30, 10, 4, "player", 540, keys[6], [keys[0], keys[2], keys[4], keys[6], keys[7]], ["coilgun-ammo", "field-rations"]),
|
||||
Entity(loadouts, "Wing Two", "ship", 145, 125, -5, 7, "player", 450, keys[6], [keys[0], keys[1], keys[6], keys[8]], ["sensor-buoy", "shield-cell"]),
|
||||
|
|
@ -189,7 +189,13 @@ internal static class AetheriaDaemonZoneGenerator
|
|||
Entity(loadouts, "Vesper Sloop", "ship", 960, 620, -3, -5, "raider", 250, keys[4], [keys[4]], ["stolen-map-fragment"]),
|
||||
Entity(loadouts, "Survey Skiff", "ship", -610, -365, 3, 5, "neutral", 210, "", [keys[4], keys[5]], ["soil-sample", "deep-scan"]),
|
||||
Entity(loadouts, "Lagrange Beacon", "station", 105, 510, 0, 0, "neutral", 190, "", [keys[0], keys[1], keys[6]], ["navigation-key"])
|
||||
];
|
||||
};
|
||||
foreach (var index in new[] { 1, 2, 3, 4 })
|
||||
entities[index].HomeEntityKey = keys[0];
|
||||
entities[2].AgentTaskCapabilities = ["attack", "defend", "explore"];
|
||||
entities[3].AgentTaskCapabilities = ["attack", "defend"];
|
||||
entities[4].AgentTaskCapabilities = ["mine", "haul", "tow", "explore"];
|
||||
return entities;
|
||||
}
|
||||
|
||||
private static AetheriaEntitySnapshot Entity(
|
||||
|
|
|
|||
|
|
@ -2530,6 +2530,7 @@ static AetheriaRuntimeEntitySnapshotCommit ToRuntimeEntity(
|
|||
{
|
||||
EntityId = entityKey ?? "",
|
||||
HomeEntityId = entity.HomeEntityKey ?? "",
|
||||
AgentTaskCapabilities = (entity.AgentTaskCapabilities ?? Array.Empty<string>()).ToArray(),
|
||||
EntityIndex = entityIndex,
|
||||
Name = entity.Name ?? "",
|
||||
Kind = entity.Kind ?? "",
|
||||
|
|
|
|||
|
|
@ -604,6 +604,9 @@ public sealed class AetheriaEntitySnapshot
|
|||
[Key(30)]
|
||||
[CultReference(typeof(AetheriaEntitySnapshot))]
|
||||
public string HomeEntityKey { get; set; } = "";
|
||||
|
||||
[Key(31)]
|
||||
public string[] AgentTaskCapabilities { get; set; } = [];
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
{
|
||||
var available = entities
|
||||
.Where(pair => pair.Entity.IsActive && string.IsNullOrWhiteSpace(pair.Entity.AssignedAgentTaskId))
|
||||
.Where(pair => !IsCurrentEntity(run, pair.ZoneIndex, pair.Entity.EntityIndex))
|
||||
.Where(pair => string.Equals(pair.Entity.FactionKey ?? "", corporation.Key, StringComparison.Ordinal))
|
||||
.Where(pair => (pair.Entity.AgentTaskCapabilities ?? Array.Empty<string>()).Contains(taskType.Key, StringComparer.Ordinal))
|
||||
.OrderBy(pair => pair.ZoneIndex)
|
||||
|
|
@ -208,6 +209,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
var assignment = FindAssignedEntity(run, task);
|
||||
if (assignment.Entity == null || assignment.Zone == null || !assignment.Entity.IsActive)
|
||||
continue;
|
||||
if (IsCurrentEntity(run, assignment.Zone.ZoneIndex, assignment.Entity.EntityIndex))
|
||||
continue;
|
||||
task.AssignedEntityIndex = assignment.Entity.EntityIndex;
|
||||
if (assignment.Zone.ZoneIndex != task.ZoneIndex)
|
||||
{
|
||||
|
|
@ -353,6 +356,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
.ToDictionary(value => value.Entity.EntityId, StringComparer.Ordinal);
|
||||
foreach (var worker in locations
|
||||
.Where(value => value.Entity.IsActive)
|
||||
.Where(value => !IsCurrentEntity(run, value.Zone.ZoneIndex, value.Entity.EntityIndex))
|
||||
.Where(value => (value.Entity.AgentTaskCapabilities ?? Array.Empty<string>()).Count > 0)
|
||||
.Where(value => string.IsNullOrWhiteSpace(value.Entity.AssignedAgentTaskId))
|
||||
.Where(value => !string.IsNullOrWhiteSpace(value.Entity.HomeEntityId)))
|
||||
|
|
@ -395,6 +399,10 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return commands;
|
||||
}
|
||||
|
||||
private static bool IsCurrentEntity(AetheriaRuntimeRunCheckpointCommit run, int zoneIndex, int entityIndex) =>
|
||||
AetheriaRuntimeRunCheckpointCommit.TryParseEntityKey(run.CurrentEntityKey, out var currentZoneIndex, out var currentEntityIndex) &&
|
||||
currentZoneIndex == zoneIndex && currentEntityIndex == entityIndex;
|
||||
|
||||
private static AetheriaRuntimeDaemonCommandDocument IdleMovement(
|
||||
int zoneIndex,
|
||||
AetheriaRuntimeEntitySnapshotCommit entity,
|
||||
|
|
|
|||
Loading…
Reference in a new issue