Skip to content

feat(engine): structure rotation, occupancy categories, demolish#1

Merged
Gizmotronn merged 1 commit into
claude/rover-game-module-eq347ofrom
feat/structure-placement-mechanics
Jul 20, 2026
Merged

feat(engine): structure rotation, occupancy categories, demolish#1
Gizmotronn merged 1 commit into
claude/rover-game-module-eq347ofrom
feat/structure-placement-mechanics

Conversation

@Gizmotronn

Copy link
Copy Markdown
Member

Summary

  • StructureDef.category (functional | decorative, defaults to functional) — occupancy is now checked per-category per-tile instead of strictly one-structure-per-tile. A decorative structure (nav beacon) can now share a tile with one functional structure; two functional structures still can't share a tile.
  • Structure.facing (optional, cosmetic) — set from the rover's facing at build time. Simulation.rotateStructure(id) cycles it 90° at a time, requiring the rover be adjacent (same range as deposit/launch).
  • Simulation.demolish(id) — removes a placed structure the rover is adjacent to. No resource refund in this pass.
  • Both new interactions exposed on RoverGame (rotateStructure, demolish) and wired into the existing audio/error event mapping (rotated/rotateFailed/demolished/demolishFailed).
  • No save-schema changes needed — serialize() already spreads the full Structure object, so facing round-trips through existing saves as undefined (defaults to 0).

Why

This closes the gap a downstream consumer (Star Sailors' Landnam) hit: base-building needs occupancy rules that distinguish decoration from function, rotation, and a way to undo a placement — none of which existed in the engine yet. Building these here rather than downstream so any game on @takeon/engine benefits.

Test plan

  • npm run test -w @takeon/engine — 63/63 passing, including 6 new tests covering decorative overlap, functional-on-functional blocking, rotation cycling, adjacency guards on rotate/demolish, and unknown-id handling
  • npm run build — engine, pixi, and the Next.js web app all typecheck and build clean against the widened types

Adds the three placement mechanics the engine was missing for
consumers that need base-building beyond single-purpose outposts:

- StructureDef gains a `category` (functional | decorative, defaults
  to functional). Occupancy is now checked per-category rather than
  per-tile, so a decorative structure (nav beacon) can share a tile
  with one functional structure; two functional structures still
  can't share a tile.
- Structure gains an optional cosmetic `facing`, set from the rover's
  facing at build time. `Simulation.rotateStructure(id)` cycles it
  90° at a time; requires the rover to be adjacent, same range as
  deposit/launch interactions.
- `Simulation.demolish(id)` removes a placed structure the rover is
  adjacent to. No resource refund in this pass — demolition is a
  deliberate, lossy action.

Both new interactions are exposed on the `RoverGame` facade
(`rotateStructure`, `demolish`) and wired into the existing audio/error
event mapping. Save/resume needs no changes since `serialize()` already
spreads the full Structure object.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@Gizmotronn Gizmotronn left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's crazy

@Gizmotronn
Gizmotronn merged commit 1e3d82a into claude/rover-game-module-eq347o Jul 20, 2026
3 checks passed
@Gizmotronn
Gizmotronn deleted the feat/structure-placement-mechanics branch July 20, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant