2026-08-11 15:07:11 -04:00
|
|
|
local BoxVariants = {}
|
|
|
|
|
|
2026-08-11 20:08:58 -04:00
|
|
|
-- Add directional sticky-puller, rigid skewer, and soft all-edge spiky variants
|
|
|
|
|
-- for every authored moveable box. All share sprites/collision with their base.
|
2026-08-11 15:07:11 -04:00
|
|
|
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")
|
2026-08-11 20:08:58 -04:00
|
|
|
addVariant(base, "spiky_", "spiky", "spiky", "spiky")
|
2026-08-11 15:07:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return assets
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return BoxVariants
|