Replace box variants with a moveable adhesion property

Collapse the spiky/sticky/skewer box-variant assets into a single per-
instance `adhesion` property on any moveable block, chosen in the editor
via a dropdown next to the colour picker and stored in the .sav alongside
the class.

- spiky -> sticky: soft grab on every true edge (goopy shader)
- skewer -> gluey: rigid weld on every true edge (spiked outline)
- old trailing-face sticky is removed; its saves fold into new sticky

Move the spike geometry + drawGlueySprite into shaders.lua, fold drawing
and the adhesion flag into GenericMoveable, and delete the three
Generic{Sticky,Spiky,Skewer} classes and box_variants.lua. Room:createEntity
normalises legacy spiky_/skewer_/sticky_ class prefixes so old saves load,
and serialization emits `adhesion`. World/map previews and the movement
proxy follow the rename.

Backfill rooms/*.sav to the new format via tools/backfill_adhesion.lua
(41 objects across 8 files). Update tests to the two-mode model; the two
tests asserting the removed lateral-shear limitation are dropped and a
legacy-load migration test added. 27/27 pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-08-21 16:34:01 -04:00
parent c348b81a93
commit 7d84f595e4
25 changed files with 4010 additions and 3797 deletions

View file

@ -14,9 +14,10 @@ function Entity:initialize(t)
self.name = t.name
self.color = Color:new(t.color)
self.collision = t.collision --"none", "moveable", "unmoveable"
self.sticky = t.sticky or false
self.skewer = t.skewer or false
self.spiky = t.spiky or false
-- Per-instance adhesion for moveable blocks: "sticky" (soft grab on every true
-- edge) or "gluey" (rigid weld on every true edge). nil = plain moveable.
-- See docs/adhesion-refactor-plan.md.
self.adhesion = t.adhesion
self.sprite = repSprite
self.shaAmount = t.sha or 1
-- onBump is a method (see Entity:onBump) so mixins like Dialogable can
@ -138,15 +139,11 @@ function Entity:canMove()
end
function Entity:isSticky()
return self.sticky
return self.adhesion == "sticky"
end
function Entity:isSkewer()
return self.skewer
end
function Entity:isSpiky()
return self.spiky
function Entity:isGluey()
return self.adhesion == "gluey"
end
function Entity:canPassOver()