Add directional sticky and skewer box variants

This commit is contained in:
Your Name 2026-08-11 15:07:11 -04:00
parent c3f5aafd77
commit f549eaf523
13 changed files with 723 additions and 101 deletions

36
box_variants.lua Normal file
View file

@ -0,0 +1,36 @@
local BoxVariants = {}
-- Add directional sticky-puller and all-edge skewer variants for every authored
-- moveable box. Both share sprite paths and collision cells with their base.
function BoxVariants.addTo(assets)
local baseBoxes = {}
for name, properties in pairs(assets) do
if properties.class == "moveable" and name:match("^box") then
table.insert(baseBoxes, {name = name, properties = properties})
end
end
local function addVariant(base, prefix, behavior, directory, visualFlag)
local name = prefix .. base.name
local properties = {
class = behavior,
directory = directory,
sprites = base.properties.sprites,
cells = base.properties.cells,
preload = base.properties.preload,
synthetic = true,
baseAsset = base.name,
}
properties[visualFlag] = true
assets[name] = properties
end
for _, base in ipairs(baseBoxes) do
addVariant(base, "sticky_", "sticky", "sticky", "goopy")
addVariant(base, "skewer_", "skewer", "skewer", "skewer")
end
return assets
end
return BoxVariants