Merge eureka/aetheria-release-faction-play-1 (cut-faction-play-1 r3, h6) into master

Catalog GameData/Aetheria.cc regenerated by replaying doctrine-catalog apply on the merged catalog, not taken from either branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-17 04:50:24 +02:00
commit d7f30ed165
33 changed files with 1792 additions and 82 deletions

View file

@ -69,6 +69,11 @@ public class Zone
private ItemManager _itemManager;
private double _time;
public List<Agent> Agents = new List<Agent>();
// One flight per faction, created on its first piloted join; unaffiliated ships share Unaffiliated. A flight owns
// what its members target and do (Agents/Flight.cs).
private static readonly Faction Unaffiliated = new Faction();
private readonly Dictionary<Faction, Flight> _flights = new Dictionary<Faction, Flight>();
public IEnumerable<Flight> Flights => _flights.Values;
// Cut 2 (docs/mining-cut.md): chunk wear, keyed by chunk. Zone.Wear is the only writer; ChunkExists and
// ChunkRadius are the only readers besides the pack/unpack round trip below.
@ -155,6 +160,16 @@ public class Zone
_entities.ObserveRemove().Subscribe(remove => _departures.Add(new Departure(remove.Value, remove.Value.Position.xz,
remove.Value.Visibility)));
// Leaving Entities, by death, docking or a transfer, is leaving the zone's pilots: the agent and its flight
// membership go with the ship, so nothing keeps flying a hull that is not here.
Entities.ObserveRemove().Subscribe(remove =>
{
var agent = Agents.FirstOrDefault(a => a.Ship == remove.Value);
if (agent == null) return;
Agents.Remove(agent);
foreach (var flight in _flights.Values) flight.Leave(agent);
});
Targets.Add(new EntityTargets());
foreach (var orbit in pack.Orbits)
@ -283,10 +298,13 @@ public class Zone
private Agent CreateAgent(Ship ship)
{
var agent = new Minion(ship);
var key = ship.Faction ?? Unaffiliated;
if (!_flights.TryGetValue(key, out var flight))
_flights[key] = flight = new Flight(ship.Faction?.Doctrine, _itemManager.GameplaySettings);
var agent = new Minion(ship, flight.Combatant);
var task = new PatrolOrbitsTask();
task.Circuit = Orbits.OrderBy(_ => _itemManager.Random.NextFloat()).Take(4).Select(x => x.Key).ToArray();
agent.Task = task;
flight.Join(agent, task);
return agent;
}
@ -327,7 +345,8 @@ public class Zone
orbit.Value.Velocity = (orbit.Value.Position - orbit.Value.PreviousPosition) / deltaTime;
}
foreach(var agent in Agents)
foreach (var flight in _flights.Values) flight.Update(deltaTime);
foreach(var agent in Agents.ToArray())
agent.Update(deltaTime);
var entities = Entities.ToArray();