diff options
Diffstat (limited to 'stairsplus/microblocks.lua')
-rw-r--r-- | stairsplus/microblocks.lua | 91 |
1 files changed, 53 insertions, 38 deletions
diff --git a/stairsplus/microblocks.lua b/stairsplus/microblocks.lua index 3d5de1f..a457d10 100644 --- a/stairsplus/microblocks.lua +++ b/stairsplus/microblocks.lua @@ -20,52 +20,67 @@ function register_micro(modname, subname, recipeitem, groups, images, descriptio }) end -function stairsplus:register_micro(modname, subname, recipeitem, fields) - local defs = { - [""] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, 0, 0.5}, - }, +local microblocks_defs = { + [""] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0, 0.5}, + }, + }, + ["_1"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5}, }, - ["_1"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5}, - }, + }, + ["_2"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5}, }, - ["_2"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5}, - }, + }, + ["_4"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5}, }, - ["_4"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5}, - }, + }, + ["_12"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5}, }, - ["_12"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5}, - }, + }, + ["_14"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5}, }, - ["_14"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5}, - }, + }, + ["_15"] = { + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0.4375, 0.5}, }, - ["_15"] = { - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, 0, 0, 0.4375, 0.5}, - }, - } } +} + +function stairsplus:register_micro_alias(modname_old, subname_old, modname_new, subname_new) + local defs = stairsplus.copytable(microblocks_defs) + for alternate, def in pairs(defs) do + minetest.register_alias(modname_old .. ":micro_" .. subname_old .. alternate, modname_new .. ":micro_" .. subname_new .. alternate) + end +end +function stairsplus:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new) + local defs = stairsplus.copytable(microblocks_defs) + for alternate, def in pairs(defs) do + minetest.register_alias_force(modname_old .. ":micro_" .. subname_old .. alternate, modname_new .. ":micro_" .. subname_new .. alternate) + end +end + +function stairsplus:register_micro(modname, subname, recipeitem, fields) + local defs = stairsplus.copytable(microblocks_defs) local desc = S("%s Microblock"):format(fields.description) for alternate, def in pairs(defs) do for k, v in pairs(fields) do |