Skip to content

feat(api): palette floor paint, region query, and walkability (#7) - #361

Open
Aduersarius wants to merge 1 commit into
Bitcoindefi:mainfrom
Aduersarius:feat/floor-paint-api-7
Open

feat(api): palette floor paint, region query, and walkability (#7)#361
Aduersarius wants to merge 1 commit into
Bitcoindefi:mainfrom
Aduersarius:feat/floor-paint-api-7

Conversation

@Aduersarius

Copy link
Copy Markdown

Summary

Resolves #7 — Etapa 1 floor API so an uploaded/palette tile can be painted onto the map floor through the persistence layer.

What landed

  • Palette-entry paint (issue literal): PUT .../floor/paint, .../paint-rectangle, .../paint-selection expand a paletteId into all layers + layer-1 blocked (same contract as the in-game editor), then write via existing atomic paintTiles drafts.
  • Blocked-only mutation PUT .../floor/blocked that preserves existing draft/published grhIndex (does not null out graphics).
  • Effective region query GET .../floor/region — base terrain.json palette id/graphics/blocked merged with draft-preferred overrides (not just override rows).
  • Walkability / isolation BFS GET .../floor/walkability (+ warning attached to paint/blocked responses) so sealing off walkable islands is detectable after collision edits.
  • Pure unit tests (npx tsx --test src/tests/floorPaint.unit.test.ts) for geometry caps, 20×20 plans, palette expansion, and isolation.

Acceptance mapping

  • Paint tile / 20×20 rectangle as one atomic TX (delegates to paintTiles BEGIN/COMMIT/ROLLBACK)
  • OOB coords → validation 400, no partial write
  • Palette entry must exist on that map’s terrain.json
  • Per-op cap 500 tiles (rectangle + selection)
  • Blocked flag mutation + isolation check (server movement still authoritative after publish)
  • Failed op rolls back via existing paint TX
  • Tests (unit; integration inherits world-builder admin gate)

Differentiation vs competing PRs

Test plan

  • cd api && npx tsx --test src/tests/floorPaint.unit.test.ts (6/6)
  • Manual: admin paint 20×20 → publish → reload map shows floor change
  • Manual: out-of-range / missing paletteId → 400/404, map unchanged
  • Manual: blocked ring → walkability reports isolated: true

…ndefi#7)

Etapa 1 floor API on top of worldBuilder.paintTiles drafts: paint by
palette entry (tile / rectangle / selection), blocked-only updates that
preserve graphics, effective region snapshots, and isolation BFS warning.
Pure unit tests cover geometry, palette expansion, and walkability.
@gitar-bot

gitar-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

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.

Etapa 1: API para pintar el piso del mapa

1 participant