aboutsummaryrefslogtreecommitdiff
path: root/stairsplus
diff options
context:
space:
mode:
authorThomas--S <Thomas--S@users.noreply.github.com>2016-10-03 12:14:34 +0200
committerHugo Locurcio <calinou@opmbx.org>2016-10-03 12:14:34 +0200
commit7f06db2200909e7e501b5092ae7b330bcef05d2a (patch)
treecb4419846ef58c0929dd9cc48914fb3950bc72ad /stairsplus
parentab2c63270f9289de717ccaf0aa21f0b871b7bc78 (diff)
downloadmoreblocks-7f06db2200909e7e501b5092ae7b330bcef05d2a.tar.gz
moreblocks-7f06db2200909e7e501b5092ae7b330bcef05d2a.tar.bz2
moreblocks-7f06db2200909e7e501b5092ae7b330bcef05d2a.zip
Add Alias Functions (#54)
* register_alias * register_alias_force
Diffstat (limited to 'stairsplus')
-rw-r--r--stairsplus/init.lua30
-rw-r--r--stairsplus/microblocks.lua91
-rw-r--r--stairsplus/panels.lua91
-rw-r--r--stairsplus/slabs.lua35
-rw-r--r--stairsplus/slopes.lua203
-rw-r--r--stairsplus/stairs.lua175
6 files changed, 365 insertions, 260 deletions
diff --git a/stairsplus/init.lua b/stairsplus/init.lua
index 44f5972..1f2cefe 100644
--- a/stairsplus/init.lua
+++ b/stairsplus/init.lua
@@ -17,6 +17,21 @@ and minetest.setting_getbool("creative_mode") then
stairsplus.expect_infinite_stacks = true
end
+function stairsplus.copytable(orig)
+ local orig_type = type(orig)
+ local copy
+ if orig_type == 'table' then
+ copy = {}
+ for orig_key, orig_value in next, orig, nil do
+ copy[stairsplus.copytable(orig_key)] = stairsplus.copytable(orig_value)
+ end
+ setmetatable(copy, stairsplus.copytable(getmetatable(orig)))
+ else
+ copy = orig
+ end
+ return copy
+end
+
function stairsplus:prepare_groups(groups)
local result = {}
if groups then
@@ -41,6 +56,21 @@ function stairsplus:register_all(modname, subname, recipeitem, fields)
-- self:register_6dfacedir_conversion(modname, subname) -- Not needed as of Q3 2013, uncomment to fix old maps.
end
+function stairsplus:register_alias_all(modname_old, subname_old, modname_new, subname_new)
+ self:register_stair_alias(modname_old, subname_old, modname_new, subname_new)
+ self:register_slab_alias(modname_old, subname_old, modname_new, subname_new)
+ self:register_slope_alias(modname_old, subname_old, modname_new, subname_new)
+ self:register_panel_alias(modname_old, subname_old, modname_new, subname_new)
+ self:register_micro_alias(modname_old, subname_old, modname_new, subname_new)
+end
+function stairsplus:register_alias_force_all(modname_old, subname_old, modname_new, subname_new)
+ self:register_stair_alias_force(modname_old, subname_old, modname_new, subname_new)
+ self:register_slab_alias_force(modname_old, subname_old, modname_new, subname_new)
+ self:register_slope_alias_force(modname_old, subname_old, modname_new, subname_new)
+ self:register_panel_alias_force(modname_old, subname_old, modname_new, subname_new)
+ self:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new)
+end
+
function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light)
stairsplus:register_all(modname, subname, recipeitem, {
groups = groups,
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
diff --git a/stairsplus/panels.lua b/stairsplus/panels.lua
index ab6ef83..314939b 100644
--- a/stairsplus/panels.lua
+++ b/stairsplus/panels.lua
@@ -20,52 +20,67 @@ function register_panel(modname, subname, recipeitem, groups, images, descriptio
})
end
-function stairsplus:register_panel(modname, subname, recipeitem, fields)
- local defs = {
- [""] = {
- node_box = {
- type = "fixed",
- fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5},
- },
+local panels_defs = {
+ [""] = {
+ node_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5},
+ },
+ },
+ ["_1"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5},
},
- ["_1"] = {
- node_box = {
- type = "fixed",
- fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5},
- },
+ },
+ ["_2"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
},
- ["_2"] = {
- node_box = {
- type = "fixed",
- fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
- },
+ },
+ ["_4"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5},
},
- ["_4"] = {
- node_box = {
- type = "fixed",
- fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5},
- },
+ },
+ ["_12"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5},
},
- ["_12"] = {
- node_box = {
- type = "fixed",
- fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5},
- },
+ },
+ ["_14"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5},
},
- ["_14"] = {
- node_box = {
- type = "fixed",
- fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5},
- },
+ },
+ ["_15"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5},
},
- ["_15"] = {
- node_box = {
- type = "fixed",
- fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5},
- },
- }
}
+}
+
+function stairsplus:register_panel_alias(modname_old, subname_old, modname_new, subname_new)
+ local defs = stairsplus.copytable(panels_defs)
+ for alternate, def in pairs(defs) do
+ minetest.register_alias(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate)
+ end
+end
+function stairsplus:register_panel_alias_force(modname_old, subname_old, modname_new, subname_new)
+ local defs = stairsplus.copytable(panels_defs)
+ for alternate, def in pairs(defs) do
+ minetest.register_alias_force(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate)
+ end
+end
+
+function stairsplus:register_panel(modname, subname, recipeitem, fields)
+ local defs = stairsplus.copytable(panels_defs)
local desc = S("%s Panel"):format(fields.description)
for alternate, def in pairs(defs) do
for k, v in pairs(fields) do
diff --git a/stairsplus/slabs.lua b/stairsplus/slabs.lua
index 236d91e..2acdd41 100644
--- a/stairsplus/slabs.lua
+++ b/stairsplus/slabs.lua
@@ -20,17 +20,32 @@ function register_slab(modname, subname, recipeitem, groups, images, description
})
end
-function stairsplus:register_slab(modname, subname, recipeitem, fields)
- local defs = {
- [""] = 8,
- ["_quarter"] = 4,
- ["_three_quarter"] = 12,
- ["_1"] = 1,
- ["_2"] = 2,
- ["_14"] = 14,
- ["_15"] = 15,
- }
+local slabs_defs = {
+ [""] = 8,
+ ["_quarter"] = 4,
+ ["_three_quarter"] = 12,
+ ["_1"] = 1,
+ ["_2"] = 2,
+ ["_14"] = 14,
+ ["_15"] = 15,
+}
+
+function stairsplus:register_slab_alias(modname_old, subname_old, modname_new, subname_new)
+ local defs = stairsplus.copytable(slabs_defs)
+ for alternate, def in pairs(defs) do
+ minetest.register_alias(modname_old .. ":slab_" .. subname_old .. alternate, modname_new .. ":slab_" .. subname_new .. alternate)
+ end
+end
+function stairsplus:register_slab_alias_force(modname_old, subname_old, modname_new, subname_new)
+ local defs = stairsplus.copytable(slabs_defs)
+ for alternate, def in pairs(defs) do
+ minetest.register_alias_force(modname_old .. ":slab_" .. subname_old .. alternate, modname_new .. ":slab_" .. subname_new .. alternate)
+ end
+end
+
+function stairsplus:register_slab(modname, subname, recipeitem, fields)
+ local defs = stairsplus.copytable(slabs_defs)
local desc_base = S("%s Slab"):format(fields.description)
for alternate, num in pairs(defs) do
local def = {
diff --git a/stairsplus/slopes.lua b/stairsplus/slopes.lua
index f0e8c20..da524b6 100644
--- a/stairsplus/slopes.lua
+++ b/stairsplus/slopes.lua
@@ -123,103 +123,118 @@ function register_slope(modname, subname, recipeitem, groups, images, descriptio
})
end
-function stairsplus:register_slope(modname, subname, recipeitem, fields)
- local defs = {
- [""] = {
- mesh = "moreblocks_slope.obj",
- collision_box = box_slope,
- selection_box = box_slope,
-
- },
- ["_half"] = {
- mesh = "moreblocks_slope_half.obj",
- collision_box = box_slope_half,
- selection_box = box_slope_half,
- },
- ["_half_raised"] = {
- mesh = "moreblocks_slope_half_raised.obj",
- collision_box = box_slope_half_raised,
- selection_box = box_slope_half_raised,
- },
-
---==============================================================
-
- ["_inner"] = {
- mesh = "moreblocks_slope_inner.obj",
- collision_box = box_slope_inner,
- selection_box = box_slope_inner,
- },
- ["_inner_half"] = {
- mesh = "moreblocks_slope_inner_half.obj",
- collision_box = box_slope_inner_half,
- selection_box = box_slope_inner_half,
- },
- ["_inner_half_raised"] = {
- mesh = "moreblocks_slope_inner_half_raised.obj",
- collision_box = box_slope_inner_half_raised,
- selection_box = box_slope_inner_half_raised,
- },
-
---==============================================================
-
- ["_inner_cut"] = {
- mesh = "moreblocks_slope_inner_cut.obj",
- collision_box = box_slope_inner,
- selection_box = box_slope_inner,
- },
- ["_inner_cut_half"] = {
- mesh = "moreblocks_slope_inner_cut_half.obj",
- collision_box = box_slope_inner_half,
- selection_box = box_slope_inner_half,
- },
- ["_inner_cut_half_raised"] = {
- mesh = "moreblocks_slope_inner_cut_half_raised.obj",
- collision_box = box_slope_inner_half_raised,
- selection_box = box_slope_inner_half_raised,
- },
+local slopes_defs = {
+ [""] = {
+ mesh = "moreblocks_slope.obj",
+ collision_box = box_slope,
+ selection_box = box_slope,
---==============================================================
+ },
+ ["_half"] = {
+ mesh = "moreblocks_slope_half.obj",
+ collision_box = box_slope_half,
+ selection_box = box_slope_half,
+ },
+ ["_half_raised"] = {
+ mesh = "moreblocks_slope_half_raised.obj",
+ collision_box = box_slope_half_raised,
+ selection_box = box_slope_half_raised,
+ },
- ["_outer"] = {
- mesh = "moreblocks_slope_outer.obj",
- collision_box = box_slope_outer,
- selection_box = box_slope_outer,
- },
- ["_outer_half"] = {
- mesh = "moreblocks_slope_outer_half.obj",
- collision_box = box_slope_outer_half,
- selection_box = box_slope_outer_half,
- },
- ["_outer_half_raised"] = {
- mesh = "moreblocks_slope_outer_half_raised.obj",
- collision_box = box_slope_outer_half_raised,
- selection_box = box_slope_outer_half_raised,
- },
-
---==============================================================
-
- ["_outer_cut"] = {
- mesh = "moreblocks_slope_outer_cut.obj",
- collision_box = box_slope_outer,
- selection_box = box_slope_outer,
- },
- ["_outer_cut_half"] = {
- mesh = "moreblocks_slope_outer_cut_half.obj",
- collision_box = box_slope_outer_half,
- selection_box = box_slope_outer_half,
- },
- ["_outer_cut_half_raised"] = {
- mesh = "moreblocks_slope_outer_cut_half_raised.obj",
- collision_box = box_slope_outer_half_raised,
- selection_box = box_slope_outer_half_raised,
- },
- ["_cut"] = {
- mesh = "moreblocks_slope_cut.obj",
- collision_box = box_slope_outer,
- selection_box = box_slope_outer,
- },
- }
+ --==============================================================
+
+ ["_inner"] = {
+ mesh = "moreblocks_slope_inner.obj",
+ collision_box = box_slope_inner,
+ selection_box = box_slope_inner,
+ },
+ ["_inner_half"] = {
+ mesh = "moreblocks_slope_inner_half.obj",
+ collision_box = box_slope_inner_half,
+ selection_box = box_slope_inner_half,
+ },
+ ["_inner_half_raised"] = {
+ mesh = "moreblocks_slope_inner_half_raised.obj",
+ collision_box = box_slope_inner_half_raised,
+ selection_box = box_slope_inner_half_raised,
+ },
+
+ --==============================================================
+
+ ["_inner_cut"] = {
+ mesh = "moreblocks_slope_inner_cut.obj",
+ collision_box = box_slope_inner,
+ selection_box = box_slope_inner,
+ },
+ ["_inner_cut_half"] = {
+ mesh = "moreblocks_slope_inner_cut_half.obj",
+ collision_box = box_slope_inner_half,
+ selection_box = box_slope_inner_half,
+ },
+ ["_inner_cut_half_raised"] = {
+ mesh = "moreblocks_slope_inner_cut_half_raised.obj",
+ collision_box = box_slope_inner_half_raised,
+ selection_box = box_slope_inner_half_raised,
+ },
+
+ --==============================================================
+
+ ["_outer"] = {
+ mesh = "moreblocks_slope_outer.obj",
+ collision_box = box_slope_outer,
+ selection_box = box_slope_outer,
+ },
+ ["_outer_half"] = {
+ mesh = "moreblocks_slope_outer_half.obj",
+ collision_box = box_slope_outer_half,
+ selection_box = box_slope_outer_half,
+ },
+ ["_outer_half_raised"] = {
+ mesh = "moreblocks_slope_outer_half_raised.obj",
+ collision_box = box_slope_outer_half_raised,
+ selection_box = box_slope_outer_half_raised,
+ },
+
+ --==============================================================
+ ["_outer_cut"] = {
+ mesh = "moreblocks_slope_outer_cut.obj",
+ collision_box = box_slope_outer,
+ selection_box = box_slope_outer,
+ },
+ ["_outer_cut_half"] = {
+ mesh = "moreblocks_slope_outer_cut_half.obj",
+ collision_box = box_slope_outer_half,
+ selection_box = box_slope_outer_half,
+ },
+ ["_outer_cut_half_raised"] = {
+ mesh = "moreblocks_slope_outer_cut_half_raised.obj",
+ collision_box = box_slope_outer_half_raised,
+ selection_box = box_slope_outer_half_raised,
+ },
+ ["_cut"] = {
+ mesh = "moreblocks_slope_cut.obj",
+ collision_box = box_slope_outer,
+ selection_box = box_slope_outer,
+ },
+}
+
+function stairsplus:register_slope_alias(modname_old, subname_old, modname_new, subname_new)
+ local defs = stairsplus.copytable(slopes_defs)
+ for alternate, def in pairs(defs) do
+ minetest.register_alias(modname_old .. ":slope_" .. subname_old .. alternate, modname_new .. ":slope_" .. subname_new .. alternate)
+ end
+end
+
+function stairsplus:register_slope_alias_force(modname_old, subname_old, modname_new, subname_new)
+ local defs = stairsplus.copytable(slopes_defs)
+ for alternate, def in pairs(defs) do
+ minetest.register_alias_force(modname_old .. ":slope_" .. subname_old .. alternate, modname_new .. ":slope_" .. subname_new .. alternate)
+ end
+end
+
+function stairsplus:register_slope(modname, subname, recipeitem, fields)
+ local defs = stairsplus.copytable(slopes_defs)
local desc = S("%s Slope"):format(fields.description)
for alternate, def in pairs(defs) do
for k, v in pairs(fields) do
diff --git a/stairsplus/stairs.lua b/stairsplus/stairs.lua
index ee8075f..6609466 100644
--- a/stairsplus/stairs.lua
+++ b/stairsplus/stairs.lua
@@ -20,92 +20,107 @@ function register_stair(modname, subname, recipeitem, groups, images, descriptio
})
end
-function stairsplus:register_stair(modname, subname, recipeitem, fields)
- local defs = {
- [""] = {
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
- {-0.5, 0, 0, 0.5, 0.5, 0.5},
- },
+local stairs_defs = {
+ [""] = {
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+ {-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
- ["_half"] = {
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.5, -0.5, 0, 0, 0.5},
- {-0.5, 0, 0, 0, 0.5, 0.5},
- },
+ },
+ ["_half"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, -0.5, 0, 0, 0.5},
+ {-0.5, 0, 0, 0, 0.5, 0.5},
},
},
- ["_right_half" ]= {
- node_box = {
- type = "fixed",
- fixed = {
- {0, -0.5, -0.5, 0.5, 0, 0.5},
- {0, 0, 0, 0.5, 0.5, 0.5},
- },
+ },
+ ["_right_half" ]= {
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {0, -0.5, -0.5, 0.5, 0, 0.5},
+ {0, 0, 0, 0.5, 0.5, 0.5},
},
},
- ["_inner"] = {
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
- {-0.5, 0, 0, 0.5, 0.5, 0.5},
- {-0.5, 0, -0.5, 0, 0.5, 0},
- },
+ },
+ ["_inner"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+ {-0.5, 0, 0, 0.5, 0.5, 0.5},
+ {-0.5, 0, -0.5, 0, 0.5, 0},
},
},
- ["_outer"] = {
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
- {-0.5, 0, 0, 0, 0.5, 0.5},
- },
+ },
+ ["_outer"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+ {-0.5, 0, 0, 0, 0.5, 0.5},
},
},
- ["_alt"] = {
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.5, -0.5, 0.5, 0, 0},
- {-0.5, 0, 0, 0.5, 0.5, 0.5},
- },
+ },
+ ["_alt"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.5, -0.5, 0.5, 0, 0},
+ {-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
- ["_alt_1"] = {
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.0625, -0.5, 0.5, 0, 0},
- {-0.5, 0.4375, 0, 0.5, 0.5, 0.5},
- },
+ },
+ ["_alt_1"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.0625, -0.5, 0.5, 0, 0},
+ {-0.5, 0.4375, 0, 0.5, 0.5, 0.5},
},
},
- ["_alt_2"] = {
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.125, -0.5, 0.5, 0, 0},
- {-0.5, 0.375, 0, 0.5, 0.5, 0.5},
- },
+ },
+ ["_alt_2"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.125, -0.5, 0.5, 0, 0},
+ {-0.5, 0.375, 0, 0.5, 0.5, 0.5},
},
},
- ["_alt_4"] = {
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.25, -0.5, 0.5, 0, 0},
- {-0.5, 0.25, 0, 0.5, 0.5, 0.5},
- },
+ },
+ ["_alt_4"] = {
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5, -0.25, -0.5, 0.5, 0, 0},
+ {-0.5, 0.25, 0, 0.5, 0.5, 0.5},
},
},
- }
+ },
+}
+
+function stairsplus:register_stair_alias(modname_old, subname_old, modname_new, subname_new)
+ local defs = stairsplus.copytable(stairs_defs)
+ for alternate, def in pairs(defs) do
+ minetest.register_alias(modname_old .. ":stair_" .. subname_old .. alternate, modname_new .. ":stair_" .. subname_new .. alternate)
+ end
+end
+
+function stairsplus:register_stair_alias_force(modname_old, subname_old, modname_new, subname_new)
+ local defs = stairsplus.copytable(stairs_defs)
+ for alternate, def in pairs(defs) do
+ minetest.register_alias_force(modname_old .. ":stair_" .. subname_old .. alternate, modname_new .. ":stair_" .. subname_new .. alternate)
+ end
+end
+function stairsplus:register_stair(modname, subname, recipeitem, fields)
+ local defs = stairsplus.copytable(stairs_defs)
local desc = S("%s Stairs"):format(fields.description)
for alternate, def in pairs(defs) do
for k, v in pairs(fields) do
@@ -127,7 +142,7 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
circular_saw.known_nodes[recipeitem] = {modname, subname}
-- Some saw-less recipes:
-
+
minetest.register_craft({
output = modname .. ":stair_" .. subname .. " 8",
recipe = {
@@ -145,67 +160,67 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
{recipeitem, recipeitem, recipeitem},
},
})
-
+
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname,
recipe = {modname .. ":panel_" .. subname, modname .. ":slab_" .. subname},
})
-
+
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname,
recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname},
})
-
+
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_outer",
recipe = {modname .. ":micro_" .. subname, modname .. ":slab_" .. subname},
})
-
+
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_half",
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
})
-
+
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_half",
recipe = {modname .. ":panel_" .. subname, modname .. ":micro_" .. subname},
})
-
+
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_right_half",
recipe = {modname .. ":stair_" .. subname .. "_half"},
})
-
+
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname,
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
})
-
+
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_inner",
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
})
-
+
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_outer",
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
})
-
+
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname,
recipe = {modname .. ":panel_" .. subname, modname .. ":panel_" .. subname, modname .. ":panel_" .. subname},
})
-
+
minetest.register_craft({ -- See mirrored variation of the recipe below.
output = modname .. ":stair_" .. subname .. "_alt",
recipe = {
@@ -213,7 +228,7 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
{"" , modname .. ":panel_" .. subname},
},
})
-
+
minetest.register_craft({ -- Mirrored variation of the recipe above.
output = modname .. ":stair_" .. subname .. "_alt",
recipe = {