Skip to content

Commit 3e7a4f9

Browse files
committed
Add overload maneuver rendering to planning UI
Overload arrows (orange) appear around the burn destination for warships with canOverload and fuel >= 2. Course preview includes overload in computeCourse call.
1 parent 53d3af0 commit 3e7a4f9

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

src/client/renderer.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export interface AnimationState {
132132
export interface PlanningState {
133133
selectedShipId: string | null;
134134
burns: Map<string, number | null>; // shipId -> burn direction (or null for no burn)
135+
overloads: Map<string, number | null>; // shipId -> overload direction (warships only, 2 fuel total)
135136
combatTargetId: string | null; // enemy ship targeted for combat
136137
}
137138

@@ -148,7 +149,7 @@ export class Renderer {
148149
private gameState: GameState | null = null;
149150
private playerId = -1;
150151
private animState: AnimationState | null = null;
151-
planningState: PlanningState = { selectedShipId: null, burns: new Map(), combatTargetId: null };
152+
planningState: PlanningState = { selectedShipId: null, burns: new Map(), overloads: new Map(), combatTargetId: null };
152153
private combatResults: { results: CombatResult[]; showUntil: number } | null = null;
153154
private lastTime = 0;
154155

@@ -431,7 +432,8 @@ export class Renderer {
431432
const isSelected = ship.id === this.planningState.selectedShipId;
432433

433434
if (burn !== null || isSelected) {
434-
const course = computeCourse(ship, burn, map);
435+
const overload = this.planningState.overloads.get(ship.id) ?? null;
436+
const course = computeCourse(ship, burn, map, { overload });
435437
const from = hexToPixel(ship.landed ? course.path[0] : ship.position, HEX_SIZE);
436438
const to = hexToPixel(course.destination, HEX_SIZE);
437439

@@ -470,6 +472,27 @@ export class Renderer {
470472
ctx.fill();
471473
ctx.stroke();
472474
}
475+
476+
// Overload direction arrows (shown after burn is set, for warships with enough fuel)
477+
if (burn !== null) {
478+
const stats = SHIP_STATS[ship.type];
479+
if (stats?.canOverload && ship.fuel >= 2) {
480+
const burnDest = hexAdd(predDest, HEX_DIRECTIONS[burn]);
481+
for (let d = 0; d < 6; d++) {
482+
const olHex = hexAdd(burnDest, HEX_DIRECTIONS[d]);
483+
const olp = hexToPixel(olHex, HEX_SIZE);
484+
const isOlActive = overload === d;
485+
486+
ctx.fillStyle = isOlActive ? 'rgba(255, 183, 77, 0.6)' : 'rgba(255, 183, 77, 0.1)';
487+
ctx.strokeStyle = isOlActive ? '#ffb74d' : 'rgba(255, 183, 77, 0.25)';
488+
ctx.lineWidth = 1.5;
489+
ctx.beginPath();
490+
ctx.arc(olp.x, olp.y, 6, 0, Math.PI * 2);
491+
ctx.fill();
492+
ctx.stroke();
493+
}
494+
}
495+
}
473496
}
474497

475498
// Fuel cost indicator

0 commit comments

Comments
 (0)