Files
space-game/apps/backend/Contracts/WorldContracts.cs

395 lines
9.4 KiB
C#

namespace SpaceGame.Simulation.Api.Contracts;
public sealed record WorldSnapshot(
string Label,
int Seed,
long Sequence,
int TickIntervalMs,
DateTimeOffset GeneratedAtUtc,
IReadOnlyList<SystemSnapshot> Systems,
IReadOnlyList<SpatialNodeSnapshot> SpatialNodes,
IReadOnlyList<LocalBubbleSnapshot> LocalBubbles,
IReadOnlyList<ResourceNodeSnapshot> Nodes,
IReadOnlyList<StationSnapshot> Stations,
IReadOnlyList<ClaimSnapshot> Claims,
IReadOnlyList<ConstructionSiteSnapshot> ConstructionSites,
IReadOnlyList<MarketOrderSnapshot> MarketOrders,
IReadOnlyList<PolicySetSnapshot> Policies,
IReadOnlyList<ShipSnapshot> Ships,
IReadOnlyList<FactionSnapshot> Factions);
public sealed record WorldDelta(
long Sequence,
int TickIntervalMs,
DateTimeOffset GeneratedAtUtc,
bool RequiresSnapshotRefresh,
IReadOnlyList<SimulationEventRecord> Events,
IReadOnlyList<SpatialNodeDelta> SpatialNodes,
IReadOnlyList<LocalBubbleDelta> LocalBubbles,
IReadOnlyList<ResourceNodeDelta> Nodes,
IReadOnlyList<StationDelta> Stations,
IReadOnlyList<ClaimDelta> Claims,
IReadOnlyList<ConstructionSiteDelta> ConstructionSites,
IReadOnlyList<MarketOrderDelta> MarketOrders,
IReadOnlyList<PolicySetDelta> Policies,
IReadOnlyList<ShipDelta> Ships,
IReadOnlyList<FactionDelta> Factions,
ObserverScope? Scope = null);
public sealed record SimulationEventRecord(
string EntityKind,
string EntityId,
string Kind,
string Message,
DateTimeOffset OccurredAtUtc,
string Family = "simulation",
string ScopeKind = "universe",
string? ScopeEntityId = null,
string Visibility = "public");
public sealed record ObserverScope(
string ScopeKind,
string? SystemId = null,
string? BubbleId = null);
public sealed record SystemSnapshot(
string Id,
string Label,
Vector3Dto GalaxyPosition,
string StarKind,
int StarCount,
string StarColor,
float StarSize,
IReadOnlyList<PlanetSnapshot> Planets);
public sealed record PlanetSnapshot(
string Label,
string PlanetType,
string Shape,
int MoonCount,
float OrbitRadius,
float OrbitSpeed,
float OrbitEccentricity,
float OrbitInclination,
float OrbitLongitudeOfAscendingNode,
float OrbitArgumentOfPeriapsis,
float OrbitPhaseAtEpoch,
float Size,
string Color,
bool HasRing);
public sealed record ResourceNodeSnapshot(
string Id,
string SystemId,
Vector3Dto LocalPosition,
string SourceKind,
float OreRemaining,
float MaxOre,
string ItemId);
public sealed record SpatialNodeSnapshot(
string Id,
string SystemId,
string Kind,
Vector3Dto LocalPosition,
string BubbleId,
string? ParentNodeId,
string? OccupyingStructureId,
string? OrbitReferenceId);
public sealed record SpatialNodeDelta(
string Id,
string SystemId,
string Kind,
Vector3Dto LocalPosition,
string BubbleId,
string? ParentNodeId,
string? OccupyingStructureId,
string? OrbitReferenceId);
public sealed record LocalBubbleSnapshot(
string Id,
string NodeId,
string SystemId,
float Radius,
IReadOnlyList<string> OccupantShipIds,
IReadOnlyList<string> OccupantStationIds,
IReadOnlyList<string> OccupantClaimIds,
IReadOnlyList<string> OccupantConstructionSiteIds);
public sealed record LocalBubbleDelta(
string Id,
string NodeId,
string SystemId,
float Radius,
IReadOnlyList<string> OccupantShipIds,
IReadOnlyList<string> OccupantStationIds,
IReadOnlyList<string> OccupantClaimIds,
IReadOnlyList<string> OccupantConstructionSiteIds);
public sealed record ResourceNodeDelta(
string Id,
string SystemId,
Vector3Dto LocalPosition,
string SourceKind,
float OreRemaining,
float MaxOre,
string ItemId);
public sealed record InventoryEntry(
string ItemId,
float Amount);
public sealed record StationSnapshot(
string Id,
string Label,
string Category,
string SystemId,
Vector3Dto LocalPosition,
string? NodeId,
string? BubbleId,
string? AnchorNodeId,
string Color,
int DockedShips,
int DockingPads,
float EnergyStored,
IReadOnlyList<InventoryEntry> Inventory,
string FactionId,
string? CommanderId,
string? PolicySetId,
float Population,
float PopulationCapacity,
float WorkforceRequired,
float WorkforceEffectiveRatio,
IReadOnlyList<string> InstalledModules,
IReadOnlyList<string> MarketOrderIds);
public sealed record StationDelta(
string Id,
string Label,
string Category,
string SystemId,
Vector3Dto LocalPosition,
string? NodeId,
string? BubbleId,
string? AnchorNodeId,
string Color,
int DockedShips,
int DockingPads,
float EnergyStored,
IReadOnlyList<InventoryEntry> Inventory,
string FactionId,
string? CommanderId,
string? PolicySetId,
float Population,
float PopulationCapacity,
float WorkforceRequired,
float WorkforceEffectiveRatio,
IReadOnlyList<string> InstalledModules,
IReadOnlyList<string> MarketOrderIds);
public sealed record ClaimSnapshot(
string Id,
string FactionId,
string SystemId,
string NodeId,
string BubbleId,
string State,
float Health,
DateTimeOffset PlacedAtUtc,
DateTimeOffset ActivatesAtUtc);
public sealed record ClaimDelta(
string Id,
string FactionId,
string SystemId,
string NodeId,
string BubbleId,
string State,
float Health,
DateTimeOffset PlacedAtUtc,
DateTimeOffset ActivatesAtUtc);
public sealed record ConstructionSiteSnapshot(
string Id,
string FactionId,
string SystemId,
string NodeId,
string BubbleId,
string TargetKind,
string TargetDefinitionId,
string? BlueprintId,
string? ClaimId,
string? StationId,
string State,
float Progress,
IReadOnlyList<InventoryEntry> Inventory,
IReadOnlyList<InventoryEntry> RequiredItems,
IReadOnlyList<InventoryEntry> DeliveredItems,
IReadOnlyList<string> AssignedConstructorShipIds,
IReadOnlyList<string> MarketOrderIds);
public sealed record ConstructionSiteDelta(
string Id,
string FactionId,
string SystemId,
string NodeId,
string BubbleId,
string TargetKind,
string TargetDefinitionId,
string? BlueprintId,
string? ClaimId,
string? StationId,
string State,
float Progress,
IReadOnlyList<InventoryEntry> Inventory,
IReadOnlyList<InventoryEntry> RequiredItems,
IReadOnlyList<InventoryEntry> DeliveredItems,
IReadOnlyList<string> AssignedConstructorShipIds,
IReadOnlyList<string> MarketOrderIds);
public sealed record MarketOrderSnapshot(
string Id,
string FactionId,
string? StationId,
string? ConstructionSiteId,
string Kind,
string ItemId,
float Amount,
float RemainingAmount,
float Valuation,
float? ReserveThreshold,
string? PolicySetId,
string State);
public sealed record MarketOrderDelta(
string Id,
string FactionId,
string? StationId,
string? ConstructionSiteId,
string Kind,
string ItemId,
float Amount,
float RemainingAmount,
float Valuation,
float? ReserveThreshold,
string? PolicySetId,
string State);
public sealed record PolicySetSnapshot(
string Id,
string OwnerKind,
string OwnerId,
string TradeAccessPolicy,
string DockingAccessPolicy,
string ConstructionAccessPolicy,
string OperationalRangePolicy);
public sealed record PolicySetDelta(
string Id,
string OwnerKind,
string OwnerId,
string TradeAccessPolicy,
string DockingAccessPolicy,
string ConstructionAccessPolicy,
string OperationalRangePolicy);
public sealed record ShipSnapshot(
string Id,
string Label,
string Role,
string ShipClass,
string SystemId,
Vector3Dto LocalPosition,
Vector3Dto LocalVelocity,
Vector3Dto TargetLocalPosition,
string State,
string? OrderKind,
string DefaultBehaviorKind,
string ControllerTaskKind,
string? NodeId,
string? BubbleId,
string? DockedStationId,
string? CommanderId,
string? PolicySetId,
float CargoCapacity,
float WorkerPopulation,
float EnergyStored,
IReadOnlyList<InventoryEntry> Inventory,
string FactionId,
float Health,
IReadOnlyList<string> History,
ShipSpatialStateSnapshot SpatialState);
public sealed record ShipDelta(
string Id,
string Label,
string Role,
string ShipClass,
string SystemId,
Vector3Dto LocalPosition,
Vector3Dto LocalVelocity,
Vector3Dto TargetLocalPosition,
string State,
string? OrderKind,
string DefaultBehaviorKind,
string ControllerTaskKind,
string? NodeId,
string? BubbleId,
string? DockedStationId,
string? CommanderId,
string? PolicySetId,
float CargoCapacity,
float WorkerPopulation,
float EnergyStored,
IReadOnlyList<InventoryEntry> Inventory,
string FactionId,
float Health,
IReadOnlyList<string> History,
ShipSpatialStateSnapshot SpatialState);
public sealed record ShipSpatialStateSnapshot(
string SpaceLayer,
string CurrentSystemId,
string? CurrentNodeId,
string? CurrentBubbleId,
Vector3Dto? LocalPosition,
Vector3Dto? SystemPosition,
string MovementRegime,
string? DestinationNodeId,
ShipTransitSnapshot? Transit);
public sealed record ShipTransitSnapshot(
string Regime,
string? OriginNodeId,
string? DestinationNodeId,
DateTimeOffset? StartedAtUtc,
DateTimeOffset? ArrivalDueAtUtc,
float Progress);
public sealed record FactionSnapshot(
string Id,
string Label,
string Color,
float Credits,
float PopulationTotal,
float OreMined,
float GoodsProduced,
int ShipsBuilt,
int ShipsLost,
string? DefaultPolicySetId);
public sealed record FactionDelta(
string Id,
string Label,
string Color,
float Credits,
float PopulationTotal,
float OreMined,
float GoodsProduced,
int ShipsBuilt,
int ShipsLost,
string? DefaultPolicySetId);
public sealed record Vector3Dto(float X, float Y, float Z);