2013-01-20 00:36:13 +01:00
|
|
|
leaves = {
|
|
|
|
{"beech", "Beech Leaves"},
|
|
|
|
{"apple_tree", "Apple Tree Leaves"},
|
|
|
|
{"oak", "Oak Leaves"},
|
|
|
|
{"sequoia", "Sequoia Needles"},
|
|
|
|
{"birch", "Birch Leaves"},
|
|
|
|
{"palm", "Palm Leaves"},
|
|
|
|
{"spruce", "Spruce Needles"},
|
|
|
|
{"pine", "Pine Needles"},
|
|
|
|
{"willow", "Willow Leaves"},
|
|
|
|
{"rubber_tree", "Rubber Tree Leaves"},
|
|
|
|
}
|
|
|
|
|
2013-01-20 22:15:54 +01:00
|
|
|
moretrees.avoidnodes = {}
|
|
|
|
|
|
|
|
table.insert(moretrees.avoidnodes, "default:jungletree")
|
2013-01-22 02:31:28 +01:00
|
|
|
table.insert(moretrees.avoidnodes, "moretrees:jungletree_trunk")
|
|
|
|
table.insert(moretrees.avoidnodes, "moretrees:jungletree_leaves_red")
|
|
|
|
table.insert(moretrees.avoidnodes, "moretrees:jungletree_leaves_green")
|
|
|
|
table.insert(moretrees.avoidnodes, "moretrees:jungletree_leaves_yellow")
|
2013-01-22 02:50:41 +01:00
|
|
|
table.insert(moretrees.avoidnodes, "moretrees:fir_trunk")
|
|
|
|
table.insert(moretrees.avoidnodes, "moretrees:fir_leaves")
|
|
|
|
table.insert(moretrees.avoidnodes, "moretrees:fir_leaves_bright")
|
2013-01-20 22:15:54 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
for i in ipairs(leaves) do
|
|
|
|
local name = leaves[i]
|
|
|
|
minetest.register_node("moretrees:"..leaves[i][1].."_leaves", {
|
|
|
|
description = leaves[i][2],
|
|
|
|
drawtype = "allfaces_optional",
|
|
|
|
tiles = { "moretrees_"..leaves[i][1].."_leaves.png" },
|
|
|
|
paramtype = "light",
|
|
|
|
groups = {tree=1, snappy=3, flammable=2},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
})
|
2013-01-20 22:15:54 +01:00
|
|
|
table.insert(moretrees.avoidnodes, "moretrees:"..leaves[i][1].."_leaves")
|
2013-01-20 00:36:13 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
trees = {
|
|
|
|
{"beech", "Beech", nil, nil, nil },
|
|
|
|
{"apple_tree", "Apple Tree", nil, nil, nil },
|
|
|
|
{"oak", "Oak", "acorn", "Acorn", {-0.2, -0.5, -0.2, 0.2, 0, 0.2} },
|
|
|
|
{"sequoia", "Sequoia", nil, nil, nil },
|
|
|
|
{"birch", "Birch", nil, nil, nil },
|
|
|
|
{"palm", "Palm", "coconut", "Coconut", {-0.2, -0.5, -0.2, 0.2, 0, 0.2} },
|
|
|
|
{"spruce", "Spruce", "spruce_cone", "Spruce Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2} },
|
|
|
|
{"pine", "Pine", "pine_cone", "Pine Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2} },
|
|
|
|
{"willow", "Willow", nil, nil, nil },
|
|
|
|
{"rubber_tree", "Rubber Tree", nil, nil, nil },
|
|
|
|
}
|
|
|
|
|
2013-01-20 19:38:23 +01:00
|
|
|
simple_trees = { "beech", "apple_tree", "oak", "sequoia", "palm", "pine", "willow", "rubber_tree"}
|
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
for i in ipairs(trees) do
|
|
|
|
local treename = trees[i][1]
|
|
|
|
local treedesc = trees[i][2]
|
|
|
|
local fruit = trees[i][3]
|
|
|
|
local fruitdesc = trees[i][4]
|
|
|
|
local selbox = trees[i][5]
|
|
|
|
|
|
|
|
table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_trunk")
|
|
|
|
|
|
|
|
minetest.register_node("moretrees:"..treename.."_trunk", {
|
|
|
|
description = treedesc.." Trunk",
|
|
|
|
tiles = {
|
|
|
|
"moretrees_"..treename.."_top.png",
|
|
|
|
"moretrees_"..treename.."_top.png",
|
|
|
|
"moretrees_"..treename..".png"
|
|
|
|
},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
})
|
|
|
|
|
2013-01-22 02:31:28 +01:00
|
|
|
minetest.register_node("moretrees:"..treename.."_trunk_sideways", {
|
|
|
|
description = treedesc.." Trunk (sideways)",
|
|
|
|
tiles = {
|
|
|
|
"moretrees_"..treename..".png^[transformR90",
|
|
|
|
"moretrees_"..treename..".png^[transformR90",
|
|
|
|
"moretrees_"..treename.."_top.png",
|
|
|
|
"moretrees_"..treename.."_top.png",
|
|
|
|
"moretrees_"..treename..".png^[transformR90",
|
|
|
|
"moretrees_"..treename..".png^[transformR90"
|
|
|
|
},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
})
|
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
minetest.register_node("moretrees:"..treename.."_planks", {
|
|
|
|
description = treedesc.." Planks",
|
|
|
|
tiles = {"moretrees_"..treename.."_wood.png"},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("moretrees:"..treename.."_sapling", {
|
|
|
|
description = treedesc.." Sapling",
|
|
|
|
drawtype = "plantlike",
|
|
|
|
visual_scale = 1.0,
|
|
|
|
tiles = {"moretrees_"..treename.."_sapling.png"},
|
|
|
|
inventory_image = "moretrees_"..treename.."_sapling.png",
|
|
|
|
wield_image = "moretrees_"..treename.."_sapling.png",
|
|
|
|
paramtype = "light",
|
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
|
|
|
},
|
|
|
|
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
|
|
|
|
sounds = default.node_sound_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
if (fruit ~= nil) then
|
|
|
|
minetest.register_node("moretrees:"..fruit, {
|
|
|
|
description = fruitdesc,
|
|
|
|
drawtype = "plantlike",
|
|
|
|
visual_scale = 0.8,
|
|
|
|
tiles = { "moretrees_"..fruit..".png" },
|
|
|
|
inventory_image = "moretrees_"..fruit..".png",
|
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = selbox
|
|
|
|
},
|
|
|
|
groups = {fleshy=3,dig_immediate=3,flammable=2},
|
|
|
|
sounds = default.node_sound_defaults(),
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Nodes for jungle trees
|
|
|
|
|
2013-01-22 02:31:28 +01:00
|
|
|
minetest.register_node("moretrees:jungletree_sapling", {
|
2013-01-20 00:36:13 +01:00
|
|
|
description = "Jungle Tree Sapling",
|
|
|
|
drawtype = "plantlike",
|
2013-01-22 02:31:28 +01:00
|
|
|
tiles = {"moretrees_jungletree_sapling.png"},
|
2013-01-20 00:36:13 +01:00
|
|
|
paramtype = "light",
|
|
|
|
walkable = false,
|
|
|
|
groups = {snappy=2,dig_immediate=3,flammable=2},
|
|
|
|
})
|
|
|
|
|
2013-01-22 02:31:28 +01:00
|
|
|
minetest.register_node("moretrees:jungletree_trunk", {
|
|
|
|
description = "Jungle Tree trunk (sideways)",
|
|
|
|
tiles = {
|
|
|
|
"default_jungletree_top.png",
|
|
|
|
"default_jungletree_top.png",
|
|
|
|
"default_jungletree.png",
|
|
|
|
"default_jungletree.png",
|
|
|
|
"default_jungletree.png",
|
|
|
|
"default_jungletree.png"
|
|
|
|
},
|
|
|
|
groups = {wood=1,snappy=2,dig_immediate=3,flammable=2},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("moretrees:jungletree_planks", {
|
|
|
|
description = "Jungle Tree Planks",
|
|
|
|
tiles = {
|
|
|
|
"moretrees_jungletree_wood.png",
|
|
|
|
},
|
|
|
|
groups = {wood=1,snappy=2,dig_immediate=3,flammable=2},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("moretrees:jungletree_trunk_sideways", {
|
|
|
|
description = "Jungle Tree trunk (sideways)",
|
|
|
|
tiles = {
|
|
|
|
"default_jungletree.png^[transformR90",
|
|
|
|
"default_jungletree.png^[transformR90",
|
|
|
|
"default_jungletree_top.png",
|
|
|
|
"default_jungletree_top.png",
|
|
|
|
"default_jungletree.png^[transformR90",
|
|
|
|
"default_jungletree.png^[transformR90"
|
|
|
|
},
|
|
|
|
groups = {wood=1,snappy=2,dig_immediate=3,flammable=2},
|
|
|
|
})
|
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
local leaves = {"green","yellow","red"}
|
|
|
|
for color = 1, 3 do
|
2013-01-22 02:31:28 +01:00
|
|
|
local leave_name = "moretrees:jungletree_leaves_"..leaves[color]
|
2013-01-20 00:36:13 +01:00
|
|
|
minetest.register_node(leave_name, {
|
|
|
|
description = "Jungle Tree Leaves",
|
|
|
|
drawtype = "allfaces_optional",
|
2013-01-22 02:31:28 +01:00
|
|
|
tiles = {"moretrees_jungletree_leaves_"..leaves[color]..".png"},
|
2013-01-20 00:36:13 +01:00
|
|
|
paramtype = "light",
|
|
|
|
groups = {snappy=3, leafdecay=3, flammable=2},
|
|
|
|
drop = {
|
|
|
|
max_items = 1,
|
|
|
|
items = {
|
|
|
|
{
|
|
|
|
-- player will get sapling with 1/20 chance
|
2013-01-22 02:31:28 +01:00
|
|
|
items = {'moretrees:jungletree_sapling'},
|
2013-01-20 00:36:13 +01:00
|
|
|
rarity = 20,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
-- player will get leaves only if he get no saplings,
|
|
|
|
-- this is because max_items is 1
|
2013-01-22 02:31:28 +01:00
|
|
|
items = {"moretrees:jungletree_leaves_"..leaves[color]},
|
2013-01-20 00:36:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2013-01-22 02:50:41 +01:00
|
|
|
-- Nodes for firs
|
2013-01-20 00:36:13 +01:00
|
|
|
|
2013-01-22 02:50:41 +01:00
|
|
|
minetest.register_node("moretrees:fir_trunk", {
|
|
|
|
description = "Fir trunk",
|
2013-01-20 00:36:13 +01:00
|
|
|
tile_images = {
|
2013-01-22 02:50:41 +01:00
|
|
|
"moretrees_fir_trunktop.png",
|
|
|
|
"moretrees_fir_trunktop.png",
|
|
|
|
"moretrees_fir_trunk.png",
|
|
|
|
"moretrees_fir_trunk.png",
|
|
|
|
"moretrees_fir_trunk.png",
|
|
|
|
"moretrees_fir_trunk.png"
|
2013-01-20 00:36:13 +01:00
|
|
|
},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {
|
|
|
|
tree = 1,
|
|
|
|
snappy = 2,
|
|
|
|
choppy = 2,
|
|
|
|
oddly_breakable_by_hand = 1,
|
2013-01-22 02:31:28 +01:00
|
|
|
flammable = 2,
|
|
|
|
wood = 1
|
2013-01-20 00:36:13 +01:00
|
|
|
},
|
|
|
|
sounds = default.node_sound_wood_defaults()
|
|
|
|
})
|
|
|
|
|
2013-01-22 02:50:41 +01:00
|
|
|
minetest.register_node("moretrees:fir_trunk_sideways", {
|
|
|
|
description = "Fir Trunk (sideways)",
|
2013-01-20 00:36:13 +01:00
|
|
|
tile_images = {
|
2013-01-22 02:50:41 +01:00
|
|
|
"moretrees_fir_trunk.png^[transformR90",
|
|
|
|
"moretrees_fir_trunk.png^[transformR90",
|
|
|
|
"moretrees_fir_trunktop.png",
|
|
|
|
"moretrees_fir_trunktop.png",
|
|
|
|
"moretrees_fir_trunk.png^[transformR90",
|
|
|
|
"moretrees_fir_trunk.png^[transformR90"
|
2013-01-20 00:36:13 +01:00
|
|
|
},
|
2013-01-22 02:31:28 +01:00
|
|
|
paramtype2 = "facedir",
|
2013-01-20 00:36:13 +01:00
|
|
|
material = minetest.digprop_woodlike(1.0),
|
2013-01-22 02:31:28 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
groups = {
|
|
|
|
tree = 1,
|
|
|
|
snappy = 2,
|
|
|
|
choppy = 2,
|
|
|
|
oddly_breakable_by_hand = 1,
|
2013-01-22 02:31:28 +01:00
|
|
|
flammable = 2,
|
|
|
|
wood = 1
|
2013-01-20 00:36:13 +01:00
|
|
|
},
|
|
|
|
sounds = default.node_sound_wood_defaults()
|
|
|
|
})
|
|
|
|
|
2013-01-22 02:50:41 +01:00
|
|
|
minetest.register_node("moretrees:fir_leaves", {
|
2013-01-20 00:36:13 +01:00
|
|
|
drawtype = "allfaces_optional",
|
2013-01-22 02:50:41 +01:00
|
|
|
description = "Fir Leaves",
|
|
|
|
tile_images = { "moretrees_fir_leaves.png" },
|
2013-01-20 00:36:13 +01:00
|
|
|
paramtype = "light",
|
|
|
|
groups = {
|
|
|
|
snappy = 3,
|
|
|
|
leafdecay = 3,
|
|
|
|
flammable = 2
|
|
|
|
},
|
|
|
|
drop = {
|
|
|
|
max_items = 1,
|
|
|
|
items = {
|
|
|
|
{
|
|
|
|
-- player will get sapling with 1/20 chance
|
2013-01-22 02:50:41 +01:00
|
|
|
items = {'moretrees:fir_sapling'},
|
2013-01-20 00:36:13 +01:00
|
|
|
rarity = 20,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
-- player will get leaves only if he get no saplings,
|
|
|
|
-- this is because max_items is 1
|
2013-01-22 02:50:41 +01:00
|
|
|
items = {'moretrees:fir_leaves'},
|
2013-01-20 00:36:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults()
|
|
|
|
})
|
|
|
|
|
2013-01-22 02:50:41 +01:00
|
|
|
minetest.register_node("moretrees:fir_leaves_bright", {
|
2013-01-20 00:36:13 +01:00
|
|
|
drawtype = "allfaces_optional",
|
2013-01-22 02:50:41 +01:00
|
|
|
description = "Fir Leaves (Bright)",
|
|
|
|
tile_images = { "moretrees_fir_leaves_bright.png" },
|
2013-01-20 00:36:13 +01:00
|
|
|
paramtype = "light",
|
2013-01-22 02:31:28 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
groups = {
|
|
|
|
snappy = 3,
|
|
|
|
leafdecay = 3,
|
|
|
|
flammable = 2
|
|
|
|
},
|
|
|
|
drop = {
|
|
|
|
max_items = 1,
|
|
|
|
items = {
|
|
|
|
{
|
|
|
|
-- player will get sapling with 1/20 chance
|
2013-01-22 02:50:41 +01:00
|
|
|
items = {'moretrees:fir_sapling'},
|
2013-01-20 00:36:13 +01:00
|
|
|
rarity = 20,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
-- player will get leaves only if he get no saplings,
|
|
|
|
-- this is because max_items is 1
|
2013-01-22 02:50:41 +01:00
|
|
|
items = {'moretrees:fir_leaves'},
|
2013-01-20 00:36:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults()
|
|
|
|
})
|
|
|
|
|
2013-01-22 02:50:41 +01:00
|
|
|
minetest.register_node("moretrees:fir_sapling", {
|
|
|
|
description = "Fir sapling",
|
2013-01-20 00:36:13 +01:00
|
|
|
drawtype = "plantlike",
|
2013-01-22 02:50:41 +01:00
|
|
|
tile_images = {"moretrees_fir_sapling.png"},
|
2013-01-20 00:36:13 +01:00
|
|
|
paramtype = "light",
|
|
|
|
walkable = false,
|
|
|
|
groups = {
|
|
|
|
snappy = 2,
|
|
|
|
dig_immediate = 3,
|
|
|
|
flammable = 2
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_defaults(),
|
|
|
|
})
|
|
|
|
|
2013-01-22 02:31:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
-- Backward compatbility with old mods/nodes:
|
|
|
|
|
|
|
|
minetest.register_alias("default:jungletree", "moretrees:jungletree_trunk")
|
|
|
|
minetest.register_alias("jungletree:leaves_green", "moretrees:jungletree_leaves_green")
|
|
|
|
minetest.register_alias("jungletree:leaves_red", "moretrees:jungletree_leaves_red")
|
|
|
|
minetest.register_alias("jungletree:leaves_yellow", "moretrees:jungletree_leaves_yellow")
|
|
|
|
|
2013-01-22 02:50:41 +01:00
|
|
|
minetest.register_alias("moretrees:conifer_trunk", "moretrees:fir_trunk")
|
|
|
|
minetest.register_alias("moretrees:conifer_trunk_sideways", "moretrees:fir_trunk_sideways")
|
|
|
|
minetest.register_alias("moretrees:conifer_leaves", "moretrees:fir_leaves")
|
|
|
|
minetest.register_alias("moretrees:conifer_leaves_bright", "moretrees:fir_leaves_bright")
|
|
|
|
minetest.register_alias("moretrees:conifer_sapling", "moretrees:fir_sapling")
|
|
|
|
|
|
|
|
minetest.register_alias("conifers:trunk", "moretrees:fir_trunk")
|
|
|
|
minetest.register_alias("conifers:trunk_reversed", "moretrees:fir_trunk_sideways")
|
|
|
|
minetest.register_alias("conifers:leaves", "moretrees:fir_leaves")
|
|
|
|
minetest.register_alias("conifers:leaves_special", "moretrees:fir_leaves_bright")
|
|
|
|
minetest.register_alias("conifers:sapling", "moretrees:fir_sapling")
|
2013-01-22 02:31:28 +01:00
|
|
|
|