Refactor simulation and viewer architecture

This commit is contained in:
2026-03-14 15:08:49 -04:00
parent ddca4a16d5
commit 651556c916
71 changed files with 11472 additions and 9031 deletions

View File

@@ -0,0 +1,85 @@
import type {
ClaimDelta,
ClaimSnapshot,
ConstructionSiteDelta,
ConstructionSiteSnapshot,
} from "./contractsInfrastructure";
import type {
FactionDelta,
FactionSnapshot,
} from "./contractsFactions";
import type {
LocalBubbleDelta,
LocalBubbleSnapshot,
ResourceNodeDelta,
ResourceNodeSnapshot,
SpatialNodeDelta,
SpatialNodeSnapshot,
SystemSnapshot,
} from "./contractsCelestial";
import type {
MarketOrderDelta,
PolicySetDelta,
PolicySetSnapshot,
MarketOrderSnapshot,
} from "./contractsEconomy";
import type {
ShipDelta,
ShipSnapshot,
} from "./contractsShips";
export interface WorldSnapshot {
label: string;
seed: number;
sequence: number;
tickIntervalMs: number;
generatedAtUtc: string;
systems: SystemSnapshot[];
spatialNodes: SpatialNodeSnapshot[];
localBubbles: LocalBubbleSnapshot[];
nodes: ResourceNodeSnapshot[];
stations: import("./contractsInfrastructure").StationSnapshot[];
claims: ClaimSnapshot[];
constructionSites: ConstructionSiteSnapshot[];
marketOrders: MarketOrderSnapshot[];
policies: PolicySetSnapshot[];
ships: ShipSnapshot[];
factions: FactionSnapshot[];
}
export interface WorldDelta {
sequence: number;
tickIntervalMs: number;
generatedAtUtc: string;
requiresSnapshotRefresh: boolean;
events: SimulationEventRecord[];
spatialNodes: SpatialNodeDelta[];
localBubbles: LocalBubbleDelta[];
nodes: ResourceNodeDelta[];
stations: import("./contractsInfrastructure").StationDelta[];
claims: ClaimDelta[];
constructionSites: ConstructionSiteDelta[];
marketOrders: MarketOrderDelta[];
policies: PolicySetDelta[];
ships: ShipDelta[];
factions: FactionDelta[];
scope?: ObserverScope | null;
}
export interface SimulationEventRecord {
entityKind: string;
entityId: string;
kind: string;
message: string;
occurredAtUtc: string;
family?: string;
scopeKind?: string;
scopeEntityId?: string | null;
visibility?: string;
}
export interface ObserverScope {
scopeKind: string;
systemId?: string | null;
bubbleId?: string | null;
}