feat: massive AI generation

This commit is contained in:
2026-03-21 02:21:05 -04:00
parent 3b56785f9a
commit 6ccc708ae1
80 changed files with 16929 additions and 5427 deletions

View File

@@ -320,8 +320,9 @@ export function renderSystemDetails(
export function describeShipState(world: WorldState | undefined, ship: ShipSnapshot): string {
const baseState = ship.state;
const currentSubTask = ship.activeSubTasks[0];
if (baseState === "capacitor-starved") {
return `${baseState} while ${describeControllerTask(ship.controllerTaskKind)}`;
return currentSubTask ? `${baseState} while ${titleTask(currentSubTask.kind)}` : baseState;
}
if (!world || (baseState !== "ftl" && baseState !== "spooling-ftl" && baseState !== "warping" && baseState !== "spooling-warp")) {
@@ -347,75 +348,52 @@ export function describeShipState(world: WorldState | undefined, ship: ShipSnaps
return `${baseState} -> ${destinationSystem?.label ?? destinationCelestial.systemId}`;
}
function describeControllerTask(taskKind: string): string {
switch (taskKind) {
case "travel":
return "travel";
case "extract":
return "mining";
case "dock":
return "docking";
case "unload":
return "transfer";
case "deliver-construction":
return "material delivery";
case "build-construction-site":
return "site construction";
case "construct-module":
return "module construction";
case "undock":
return "undocking";
case "load-workers":
return "worker loading";
case "unload-workers":
return "worker unloading";
default:
return taskKind;
}
}
export function describeShipObjective(objective: string): string {
switch (objective) {
case "set-mining-objective": return "mine resources";
case "set-patrol-objective": return "patrol";
case "set-construction-objective": return "build station";
case "set-idle-objective": return "idle";
default: return objective;
}
return objective.replace(/[-_]+/g, " ");
}
export function describeShipBehavior(ship: ShipSnapshot): string {
return ship.behaviorPhase
? `${ship.defaultBehaviorKind} · ${ship.behaviorPhase}`
: ship.defaultBehaviorKind;
const parts = [ship.defaultBehavior.kind];
if (ship.assignment?.kind) {
parts.push(ship.assignment.kind);
}
return parts.join(" · ");
}
export function describeShipOrder(ship: ShipSnapshot): string {
const orderParts: string[] = [];
if (ship.orderKind) {
orderParts.push(ship.orderKind);
}
if (ship.commanderObjective) {
orderParts.push(describeShipObjective(ship.commanderObjective));
}
if (orderParts.length > 0) {
return orderParts.join(" · ");
const activeOrder = [...ship.orderQueue]
.sort((left, right) => right.priority - left.priority || left.createdAtUtc.localeCompare(right.createdAtUtc))[0];
if (activeOrder) {
return activeOrder.label ?? activeOrder.kind;
}
return describeControllerTask(ship.controllerTaskKind);
if (ship.assignment?.kind) {
return describeShipObjective(ship.assignment.kind);
}
if (ship.activePlan) {
return ship.activePlan.summary || ship.activePlan.kind;
}
return ship.defaultBehavior.kind;
}
export function describeShipCurrentAction(ship: ShipSnapshot): { label: string; progress: number } | undefined {
if (!ship.currentAction) {
const subTask = ship.activeSubTasks[0];
if (!subTask) {
return undefined;
}
return {
label: ship.currentAction.label,
progress: Math.max(0, Math.min(ship.currentAction.progress, 1)),
label: subTask.summary || titleTask(subTask.kind),
progress: Math.max(0, Math.min(subTask.progress, 1)),
};
}
function titleTask(value: string): string {
return value.replace(/[-_]+/g, " ");
}
export function describeShipLocation(world: WorldState | undefined, ship: ShipSnapshot): { system: string; local?: string } {
const systemId = ship.spatialState.currentSystemId || ship.systemId;
const system = world?.systems.get(systemId);