2022-06-13 06:10:36 +02:00
|
|
|
-- register shapes (e.g. 1/16 slab, 1/8 slab, 1/4 slab, etc)
|
2022-06-14 20:17:06 +02:00
|
|
|
--[[
|
|
|
|
stairsplus.api.register_shape("micro_1", {
|
|
|
|
name_format = "micro_%s_1",
|
|
|
|
description = "@1 1/16 Microblock",
|
|
|
|
shape_groups = {micro = 1},
|
|
|
|
eighths = 1,
|
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
]]
|
|
|
|
local api = stairsplus.api
|
2022-06-14 01:11:20 +02:00
|
|
|
|
2022-06-14 20:17:06 +02:00
|
|
|
api.registered_shapes = {}
|
|
|
|
api.shapes_by_group = {}
|
2022-06-14 01:11:20 +02:00
|
|
|
|
2022-06-14 20:17:06 +02:00
|
|
|
function api.register_shape(name, def)
|
2022-06-16 01:18:11 +02:00
|
|
|
stairsplus.log("info", "registering shape %q", name)
|
2022-06-14 20:17:06 +02:00
|
|
|
api.registered_shapes[name] = def
|
2022-06-14 01:11:20 +02:00
|
|
|
|
|
|
|
for group in pairs(def.shape_groups or {}) do
|
2022-06-14 20:17:06 +02:00
|
|
|
local shapes = api.shapes_by_group[group] or {}
|
2022-06-14 01:11:20 +02:00
|
|
|
table.insert(shapes, name)
|
2022-06-14 20:17:06 +02:00
|
|
|
api.shapes_by_group[group] = shapes
|
2022-06-14 01:11:20 +02:00
|
|
|
end
|
|
|
|
end
|