Add inner, outer, outer-cut slopes and their half and half-raised variations, with crafting recipes for them. Code cleanup is ongoing.

This commit is contained in:
Calinou 2014-10-29 21:06:30 +01:00
parent 851a6db870
commit ed5d0398bb

View File

@ -18,20 +18,93 @@ local box_slope = {
local box_slope_half = { local box_slope_half = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, -- NodeBox1 {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
{-0.5, -0.375, -0.25, 0.5, -0.25, 0.5}, -- NodeBox2 {-0.5, -0.375, -0.25, 0.5, -0.25, 0.5},
{-0.5, -0.25, 0, 0.5, -0.125, 0.5}, -- NodeBox3 {-0.5, -0.25, 0, 0.5, -0.125, 0.5},
{-0.5, -0.125, 0.25, 0.5, 0, 0.5}, -- NodeBox4 {-0.5, -0.125, 0.25, 0.5, 0, 0.5},
} }
} }
local box_slope_half_raised = { local box_slope_half_raised = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.125, 0.5}, -- NodeBox1 {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
{-0.5, 0.125, -0.25, 0.5, 0.25, 0.5}, -- NodeBox2 {-0.5, 0.125, -0.25, 0.5, 0.25, 0.5},
{-0.5, 0.25, 0, 0.5, 0.375, 0.5}, -- NodeBox3 {-0.5, 0.25, 0, 0.5, 0.375, 0.5},
{-0.5, 0.375, 0.25, 0.5, 0.5, 0.5}, -- NodeBox4 {-0.5, 0.375, 0.25, 0.5, 0.5, 0.5},
}
}
--==============================================================
local box_slope_inner = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
{-0.5, -0.5, -0.25, 0.5, 0, 0.5},
{-0.5, -0.5, -0.5, 0.25, 0, 0.5},
{-0.5, 0, -0.5, 0, 0.25, 0.5},
{-0.5, 0, 0, 0.5, 0.25, 0.5},
{-0.5, 0.25, 0.25, 0.5, 0.5, 0.5},
{-0.5, 0.25, -0.5, -0.25, 0.5, 0.5},
}
}
local box_slope_inner_half = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
{-0.5, -0.375, -0.25, 0.5, -0.25, 0.5},
{-0.5, -0.375, -0.5, 0.25, -0.25, 0.5},
{-0.5, -0.25, -0.5, 0, -0.125, 0.5},
{-0.5, -0.25, 0, 0.5, -0.125, 0.5},
{-0.5, -0.125, 0.25, 0.5, 0, 0.5},
{-0.5, -0.125, -0.5, -0.25, 0, 0.5},
}
}
local box_slope_inner_half_raised = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
{-0.5, 0.125, -0.25, 0.5, 0.25, 0.5},
{-0.5, 0.125, -0.5, 0.25, 0.25, 0.5},
{-0.5, 0.25, -0.5, 0, 0.375, 0.5},
{-0.5, 0.25, 0, 0.5, 0.375, 0.5},
{-0.5, 0.375, 0.25, 0.5, 0.5, 0.5},
{-0.5, 0.375, -0.5, -0.25, 0.5, 0.5},
}
}
--==============================================================
local box_slope_outer = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
{-0.5, -0.25, -0.25, 0.25, 0, 0.5},
{-0.5, 0, 0, 0, 0.25, 0.5},
{-0.5, 0.25, 0.25, -0.25, 0.5, 0.5}
}
}
local box_slope_outer_half = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
{-0.5, -0.375, -0.25, 0.25, -0.25, 0.5},
{-0.5, -0.25, 0, 0, -0.125, 0.5},
{-0.5, -0.125, 0.25, -0.25, 0, 0.5}
}
}
local box_slope_outer_half_raised = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
{-0.5, 0.125, -0.25, 0.25, 0.25, 0.5},
{-0.5, 0.25, 0, 0, 0.375, 0.5},
{-0.5, 0.375, 0.25, -0.25, 0.5, 0.5}
} }
} }
@ -66,6 +139,60 @@ function stairsplus:register_slope(modname, subname, recipeitem, fields)
collision_box = box_slope_half_raised, collision_box = box_slope_half_raised,
selection_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,
},
--==============================================================
["_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,
},
} }
local desc = S("%s Slope"):format(fields.description) local desc = S("%s Slope"):format(fields.description)
@ -87,20 +214,226 @@ function stairsplus:register_slope(modname, subname, recipeitem, fields)
-- Some saw-less recipes: -- Some saw-less recipes:
minetest.register_craft({ minetest.register_craft({
output = modname .. ":slope_" .. subname .. " 10", output = modname .. ":slope_" .. subname .. " 7",
recipe = { recipe = {
{modname .. ":stair_" .. subname, "", ""}, {modname .. ":panel_" .. subname, "", ""},
{recipeitem, modname .. ":stair_" .. subname, ""}, {recipeitem, modname .. ":panel_" .. subname, ""},
{recipeitem, recipeitem, modname .. ":stair_" .. subname}, {recipeitem, recipeitem, modname .. ":panel_" .. subname},
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = modname .. ":slope_" .. subname .. " 10", output = modname .. ":slope_" .. subname .. " 7",
recipe = { recipe = {
{"", "", modname .. ":stair_" .. subname}, {"", "", modname .. ":panel_" .. subname},
{"", modname .. ":stair_" .. subname, recipeitem}, {"", modname .. ":panel_" .. subname, recipeitem},
{modname .. ":stair_" .. subname, recipeitem, recipeitem}, {modname .. ":panel_" .. subname, recipeitem, recipeitem},
}, },
}) })
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_half 10",
recipe = {
{modname .. ":panel_" .. subname, "", ""},
{recipeitem, recipeitem, modname .. ":panel_" .. subname},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_half 10",
recipe = {
{"", "", modname .. ":panel_" .. subname},
{modname .. ":panel_" .. subname, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_half_raised 7",
recipe = {
{modname .. ":panel_" .. subname, "", ""},
{recipeitem, recipeitem, modname .. ":panel_" .. subname},
{recipeitem, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_half_raised 7",
recipe = {
{"", "", modname .. ":panel_" .. subname},
{modname .. ":panel_" .. subname, recipeitem, recipeitem},
{recipeitem, recipeitem, recipeitem},
},
})
--===================================================== Inner ==
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner 7",
recipe = {
{modname .. ":stair_" .. subname .. "_half", "", ""},
{recipeitem, modname .. ":stair_" .. subname .. "_half", ""},
{recipeitem, recipeitem, modname .. ":stair_" .. subname .. "_half"},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner 7",
recipe = {
{"", "", modname .. ":stair_" .. subname .. "_half"},
{"", modname .. ":stair_" .. subname .. "_half", recipeitem},
{modname .. ":stair_" .. subname .. "_half", recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner_half 10",
recipe = {
{modname .. ":stair_" .. subname .. "_half", "", ""},
{recipeitem, recipeitem, modname .. ":stair_" .. subname .. "_half"},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner_half 10",
recipe = {
{"", "", modname .. ":stair_" .. subname .. "_half"},
{modname .. ":stair_" .. subname .. "_half", recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner_half_raised 7",
recipe = {
{modname .. ":stair_" .. subname .. "_half", "", ""},
{recipeitem, recipeitem, modname .. ":stair_" .. subname .. "_half"},
{recipeitem, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner_half_raised 7",
recipe = {
{"", "", modname .. ":stair_" .. subname .. "_half"},
{modname .. ":stair_" .. subname .. "_half", recipeitem, recipeitem},
{recipeitem, recipeitem, recipeitem},
},
})
--===================================================== Outer ==
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer 7",
recipe = {
{modname .. ":micro_" .. subname, "", ""},
{recipeitem, modname .. ":micro_" .. subname, ""},
{recipeitem, recipeitem, modname .. ":micro_" .. subname},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer 7",
recipe = {
{"", "", modname .. ":micro_" .. subname},
{"", modname .. ":micro_" .. subname, recipeitem},
{modname .. ":micro_" .. subname, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer_half 10",
recipe = {
{modname .. ":micro_" .. subname, "", ""},
{recipeitem, recipeitem, modname .. ":micro_" .. subname},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer_half 10",
recipe = {
{"", "", modname .. ":micro_" .. subname},
{modname .. ":micro_" .. subname, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer_half_raised 7",
recipe = {
{modname .. ":micro_" .. subname, "", ""},
{recipeitem, recipeitem, modname .. ":micro_" .. subname},
{recipeitem, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer_half_raised 7",
recipe = {
{"", "", modname .. ":micro_" .. subname},
{modname .. ":micro_" .. subname, recipeitem, recipeitem},
{recipeitem, recipeitem, recipeitem},
},
})
--================================================= Shapeless ==
minetest.register_craft({
type = "shapeless",
output = recipeitem,
recipe = {modname .. ":slope_" .. subname, modname .. ":slope_" .. subname},
})
minetest.register_craft({
type = "shapeless",
output = recipeitem,
recipe = {modname .. ":slope_" .. subname .. "_outer_cut", modname .. ":slope_" .. subname .. "_outer_cut"},
})
minetest.register_craft({
type = "shapeless",
output = recipeitem,
recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half_raised"},
})
minetest.register_craft({
type = "shapeless",
output = recipeitem,
recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half",
modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slab_" .. subname,
recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_half_raised",
recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half",
modname .. ":slope_" .. subname .. "_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_half_raised",
recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_outer_cut",
recipe = {modname .. ":slope_" .. subname .. "_outer"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_outer_cut_half",
recipe = {modname .. ":slope_" .. subname .. "_outer_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_outer_cut_half_raised",
recipe = {modname .. ":slope_" .. subname .. "_outer_half_raised"},
})
end end