feat: goap ai for faction and ship
This commit is contained in:
@@ -12,7 +12,9 @@ export interface ShipSnapshot {
|
||||
state: string;
|
||||
orderKind: string | null;
|
||||
defaultBehaviorKind: string;
|
||||
behaviorPhase: string | null;
|
||||
controllerTaskKind: string;
|
||||
commanderObjective: string | null;
|
||||
nodeId?: string | null;
|
||||
bubbleId?: string | null;
|
||||
dockedStationId?: string | null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { inventoryAmount } from "./viewerMath";
|
||||
import { describeShipCurrentAction, describeShipLocation, describeShipState } from "./viewerSelection";
|
||||
import { describeShipCurrentAction, describeShipLocation, describeShipObjective, describeShipState } from "./viewerSelection";
|
||||
import type { CameraMode, Selectable, WorldState, ZoomLevel } from "./viewerTypes";
|
||||
|
||||
export function renderFactionStrip(
|
||||
@@ -65,8 +65,8 @@ export function renderFactionStrip(
|
||||
</div>
|
||||
` : ""}
|
||||
<div class="ship-card-ai">
|
||||
<p>Order ${ship.orderKind ?? "none"}</p>
|
||||
<p>Behavior ${ship.defaultBehaviorKind}</p>
|
||||
${ship.commanderObjective ? `<p>Objective ${describeShipObjective(ship.commanderObjective)}</p>` : ""}
|
||||
<p>Behavior ${ship.defaultBehaviorKind}${ship.behaviorPhase ? ` · ${ship.behaviorPhase}` : ""}</p>
|
||||
<p>Task ${ship.controllerTaskKind}</p>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
formatSystemDistance,
|
||||
inventoryAmount,
|
||||
} from "./viewerMath";
|
||||
import { describeOrbitalParent, describeSelectable, describeShipCurrentAction, describeShipState, describeSpatialNodePathWithinSystem, getSelectionGroup, renderSystemDetails } from "./viewerSelection";
|
||||
import { describeOrbitalParent, describeSelectable, describeShipCurrentAction, describeShipObjective, describeShipState, describeSpatialNodePathWithinSystem, getSelectionGroup, renderSystemDetails } from "./viewerSelection";
|
||||
import type {
|
||||
CameraMode,
|
||||
HistoryWindowState,
|
||||
@@ -203,6 +203,9 @@ export function updateDetailPanel(
|
||||
detailBodyEl.innerHTML = `
|
||||
<p>Parent ${parent}</p>
|
||||
<p>State ${shipState}</p>
|
||||
${ship.commanderObjective ? `<p>Objective ${describeShipObjective(ship.commanderObjective)}</p>` : ""}
|
||||
<p>Behavior ${ship.defaultBehaviorKind}${ship.behaviorPhase ? ` · ${ship.behaviorPhase}` : ""}</p>
|
||||
<p>Task ${ship.controllerTaskKind}</p>
|
||||
${shipAction ? `
|
||||
<div class="detail-progress">
|
||||
<div class="detail-progress-label">
|
||||
|
||||
@@ -349,6 +349,16 @@ function describeControllerTask(taskKind: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
export function describeShipCurrentAction(ship: ShipSnapshot): { label: string; progress: number } | undefined {
|
||||
if (!ship.currentAction) {
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user