feat: tactical icons, follow-camera orbit, and ship info panel
This commit is contained in:
@@ -46,7 +46,18 @@ export function describeHoverLabel(world: WorldState | undefined, item: Selectab
|
||||
}
|
||||
|
||||
if (item.kind === "ship") {
|
||||
return world.ships.get(item.id)?.label ?? item.id;
|
||||
const ship = world.ships.get(item.id);
|
||||
if (!ship) {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
const lines = [
|
||||
ship.label,
|
||||
`Behavior ${describeShipBehavior(ship)}`,
|
||||
`State ${describeShipState(world, ship)}`,
|
||||
`Order ${describeShipOrder(ship)}`,
|
||||
];
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
if (item.kind === "station") {
|
||||
@@ -373,6 +384,27 @@ export function describeShipObjective(objective: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
export function describeShipBehavior(ship: ShipSnapshot): string {
|
||||
return ship.behaviorPhase
|
||||
? `${ship.defaultBehaviorKind} · ${ship.behaviorPhase}`
|
||||
: ship.defaultBehaviorKind;
|
||||
}
|
||||
|
||||
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(" · ");
|
||||
}
|
||||
|
||||
return describeControllerTask(ship.controllerTaskKind);
|
||||
}
|
||||
|
||||
export function describeShipCurrentAction(ship: ShipSnapshot): { label: string; progress: number } | undefined {
|
||||
if (!ship.currentAction) {
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user