diff --git a/src/components/frontend/minigames/call-for-fire-versus/VersusMatch.tsx b/src/components/frontend/minigames/call-for-fire-versus/VersusMatch.tsx
index b0a2be93..3e989c14 100644
--- a/src/components/frontend/minigames/call-for-fire-versus/VersusMatch.tsx
+++ b/src/components/frontend/minigames/call-for-fire-versus/VersusMatch.tsx
@@ -144,10 +144,11 @@ function PlacementPhase({
const placeAt = useCallback(
(x: number, y: number) => {
- // Clicking a placed emplacement picks it up instead of overwriting it.
+ // Clicking a placed emplacement picks it up; its own cells stay inert so a
+ // double-click can rotate it without also nudging its anchor.
const existing = occupied.get(`${x},${y}`);
- if (existing && existing !== selectedId) {
- setSelectedId(existing);
+ if (existing) {
+ if (existing !== selectedId) setSelectedId(existing);
setError(null);
return;
}
@@ -155,7 +156,10 @@ function PlacementPhase({
const definition = FOB_FLEET.find((f) => f.id === selectedId);
if (!definition) return;
const origin: GridPoint = { x, y };
- const cells = cellsForFob(definition, origin, orientation, BOARD);
+ // Keep an already-placed emplacement's orientation when moving it; only
+ // fall back to the toggle default for a brand-new placement.
+ const placeOrientation = placements[selectedId]?.orientation ?? orientation;
+ const cells = cellsForFob(definition, origin, placeOrientation, BOARD);
if (!cells) {
setError(`${definition.label} does not fit there.`);
return;
@@ -182,7 +186,7 @@ function PlacementPhase({
setError(null);
setPlacements((current) => ({
...current,
- [selectedId]: { assetId: selectedId, origin, orientation },
+ [selectedId]: { assetId: selectedId, origin, orientation: placeOrientation },
}));
const nextUnplaced = FOB_FLEET.find((f) => f.id !== selectedId && !placements[f.id]);
if (nextUnplaced) setSelectedId(nextUnplaced.id);
@@ -190,6 +194,44 @@ function PlacementPhase({
[occupied, orientation, placements, selectedId],
);
+ /** Double-click a placed line emplacement to flip its orientation in place. */
+ const rotateAsset = useCallback(
+ (assetId: string) => {
+ const definition = FOB_FLEET.find((f) => f.id === assetId);
+ const placement = placements[assetId];
+ if (!definition || !placement || definition.shape === "square") return;
+ const nextOrientation: FobOrientation = placement.orientation === "h" ? "v" : "h";
+ const cells = cellsForFob(definition, placement.origin, nextOrientation, BOARD);
+ if (!cells) {
+ setError(`${definition.label} does not fit rotated there.`);
+ return;
+ }
+ const conflict = FOB_FLEET.find((other) => {
+ if (other.id === assetId) return false;
+ const otherPlacement = placements[other.id];
+ if (!otherPlacement) return false;
+ const otherCells = cellsForFob(
+ other,
+ otherPlacement.origin,
+ otherPlacement.orientation,
+ BOARD,
+ );
+ return Boolean(otherCells?.some((c) => cells.some((n) => n.x === c.x && n.y === c.y)));
+ });
+ if (conflict) {
+ setError(`Cannot rotate: it would overlap the ${conflict.label}.`);
+ return;
+ }
+ setError(null);
+ setSelectedId(assetId);
+ setPlacements((current) => ({
+ ...current,
+ [assetId]: { ...placement, orientation: nextOrientation },
+ }));
+ },
+ [placements],
+ );
+
const allPlaced = FOB_FLEET.every((definition) => placements[definition.id]);
const confirm = useCallback(async () => {
@@ -206,6 +248,18 @@ function PlacementPhase({
else setError(result.error ?? "Could not confirm your emplacements.");
}, [allPlaced, match.matchId, onMatch, placements]);
+ const selectedIsSquare = selectedDefinition.shape === "square";
+ const effectiveOrientation = selectedPlacement ? selectedPlacement.orientation : orientation;
+
+ const toggleOrientation = useCallback(() => {
+ if (selectedIsSquare) return;
+ if (selectedPlacement) {
+ rotateAsset(selectedId);
+ return;
+ }
+ setOrientation((value) => (value === "h" ? "v" : "h"));
+ }, [rotateAsset, selectedId, selectedIsSquare, selectedPlacement]);
+
return (
@@ -281,12 +335,15 @@ function PlacementPhase({
);
})}
@@ -311,17 +368,28 @@ function PlacementPhase({
occupied={occupied}
preview={new Set(previewCells.map(key))}
previewClass={fobStyle(selectedId).cell}
+ selectedId={selectedId}
disabled={false}
onPlace={placeAt}
+ onRotate={rotateAsset}
/>
))}
-
- Select an emplacement, then click a cell to set its anchor. Click a placed emplacement to
- pick it up and move it. Toggle orientation for the longer assets.
-
+
+
How to emplace
+
+
Select an emplacement above, then click a cell to anchor it there.
+
Click a placed emplacement to pick it up, then click a new cell to move it.
+
+ Double-click a placed emplacement, or press the Horizontal/Vertical toggle, to rotate
+ it in place. The Command Post is a fixed 2x2 block and does not rotate.
+
+
The toggle also sets the orientation used for your next placement.
+
Emplacements cannot overlap, and your opponent never sees your layout.