minetest-mm/mods/mywoodslopes/moretrees.lua

206 lines
5.8 KiB
Lua
Raw Normal View History

2020-10-25 19:05:08 +01:00
local slope_cbox = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
{-0.5, -0.25, -0.25, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.25, 0.5},
{-0.5, 0.25, 0.25, 0.5, 0.5, 0.5}
}
}
local icorner_cbox = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, -- NodeBox5
{-0.5, -0.5, -0.25, 0.5, 0, 0.5}, -- NodeBox6
{-0.5, -0.5, -0.5, 0.25, 0, 0.5}, -- NodeBox7
{-0.5, 0, -0.5, 0, 0.25, 0.5}, -- NodeBox8
{-0.5, 0, 0, 0.5, 0.25, 0.5}, -- NodeBox9
{-0.5, 0.25, 0.25, 0.5, 0.5, 0.5}, -- NodeBox10
{-0.5, 0.25, -0.5, -0.25, 0.5, 0.5}, -- NodeBox11
}
}
local ocorner_cbox = {
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 moretrees_slopes = { --Material , Description , Item, Image
{ "apple" , "Apple Plank" , "moretrees:apple_planks", "apple_tree"},
{"beech", "Beech Plank", "moretrees:beech_planks", "beech"},
{"oak", "Oak Plank", "moretrees:oak_planks", "oak"},
{"sequoia", "Giant Sequoia Plank", "moretrees:sequoia_planks", "sequoia"},
{"birch", "Birch Plank", "moretrees:birch_planks", "birch"},
{"palm", "Palm Plank", "moretrees:palm_planks", "palm"},
{"spruce", "Spruce Plank", "moretrees:spruce_planks", "spruce"},
{"willow", "Willow Plank", "moretrees:willow_planks", "willow"},
{"rubber", "Rubber Plank", "moretrees:rubber_tree_planks","rubber_tree"},
{"fir", "Douglas Fir Plank", "moretrees:fir_planks", "fir"},
}
for i in ipairs(moretrees_slopes) do
local mat = moretrees_slopes[i][1]
local desc = moretrees_slopes[i][2]
local item = moretrees_slopes[i][3]
local img = moretrees_slopes[i][4]
--slope
minetest.register_node("mywoodslopes:"..mat.."_slope", {
description = desc.." Slope",
drawtype = "mesh",
mesh = "twelve-twelve.obj",
tiles = {"moretrees_"..img.."_wood.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
collision_box = slope_cbox,
selection_box = slope_cbox
})
--icorner
minetest.register_node("mywoodslopes:"..mat.."_icorner", {
description = desc.." Slope Inside Corner",
drawtype = "mesh",
mesh = "twelve-twelve-ic.obj",
tiles = {"moretrees_"..img.."_wood.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
collision_box = icorner_cbox,
selection_box = icorner_cbox
})
--ocorner
minetest.register_node("mywoodslopes:"..mat.."_ocorner", {
description = desc.." Slope Outside Corner",
drawtype = "mesh",
mesh = "twelve-twelve-oc.obj",
tiles = {"moretrees_"..img.."_wood.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
collision_box = ocorner_cbox,
selection_box = ocorner_cbox
})
--rotated---------------------------------------------------------------
--slope
minetest.register_node("mywoodslopes:"..mat.."_slope_r", {
description = desc.." Slope Rotated",
drawtype = "mesh",
mesh = "twelve-twelve.obj",
tiles = {"moretrees_"..img.."_wood.png^[transformR90"},
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
collision_box = slope_cbox,
selection_box = slope_cbox
})
--icorner
minetest.register_node("mywoodslopes:"..mat.."_icorner_r", {
description = desc.." Slope Inside Corner Rotate",
drawtype = "mesh",
mesh = "twelve-twelve-ic.obj",
tiles = {"moretrees_"..img.."_wood.png^[transformR90"},
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
collision_box = icorner_cbox,
selection_box = icorner_cbox
})
--ocorner
minetest.register_node("mywoodslopes:"..mat.."_ocorner_r", {
description = desc.." Slope Outside Corner Rotated",
drawtype = "mesh",
mesh = "twelve-twelve-oc.obj",
tiles = {"moretrees_"..img.."_wood.png^[transformR90"},
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
collision_box = ocorner_cbox,
selection_box = ocorner_cbox
})
--Crafts--------------------------------------------------------
--slope
minetest.register_craft({
output = "mywoodslopes:"..mat.."_slope 3",
recipe = {
{"", "",""},
{item, "",""},
{item, item,""},
}
})
--slope icorner
minetest.register_craft({
output = "mywoodslopes:"..mat.."_icorner 3",
recipe = {
{"", "",""},
{"", item,""},
{item,"", item},
}
})
--slope ocorner
minetest.register_craft({
output = "mywoodslopes:"..mat.."_ocorner 3",
recipe = {
{"", "",""},
{item, "",item},
{"", item,""},
}
})
--rotated-----------------------------------------------
--slope
minetest.register_craft({
output = "mywoodslopes:"..mat.."_slope_r 1",
recipe = {
{"", "",""},
{"", "mywoodslopes:"..mat.."_slope",""},
{"", "",""},
}
})
--slope icorner
minetest.register_craft({
output = "mywoodslopes:"..mat.."_icorner_r 1",
recipe = {
{"", "",""},
{"", "mywoodslopes:"..mat.."_icorner",""},
{"", "",""},
}
})
--slope ocorner
minetest.register_craft({
output = "mywoodslopes:"..mat.."_ocorner_r 1",
recipe = {
{"", "",""},
{"", "mywoodslopes:"..mat.."_ocorner",""},
{"", "",""},
}
})
--]]
end