diff options
Diffstat (limited to 'moreblocks/stairsplus/slopes.lua')
-rw-r--r-- | moreblocks/stairsplus/slopes.lua | 203 |
1 files changed, 109 insertions, 94 deletions
diff --git a/moreblocks/stairsplus/slopes.lua b/moreblocks/stairsplus/slopes.lua index f0e8c20..da524b6 100644 --- a/moreblocks/stairsplus/slopes.lua +++ b/moreblocks/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 |