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 00:36:13 +01:00
|
|
|
|
|
|
|
trees = {
|
2013-02-11 06:09:53 +01:00
|
|
|
{"beech", "Beech Tree"},
|
|
|
|
{"apple_tree", "Apple Tree"},
|
|
|
|
{"oak", "Oak Tree", "acorn", "Acorn", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
|
|
|
|
{"sequoia", "Giant Sequoia"},
|
|
|
|
{"birch", "Birch Tree"},
|
|
|
|
{"palm", "Palm Tree", "coconut", "Coconut", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 1.0 },
|
|
|
|
{"spruce", "Spruce Tree", "spruce_cone", "Spruce Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
|
|
|
|
{"pine", "Pine Tree", "pine_cone", "Pine Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
|
|
|
|
{"willow", "Willow Tree"},
|
|
|
|
{"rubber_tree", "Rubber Tree"},
|
2013-01-25 05:22:46 +01:00
|
|
|
{"jungletree", "Jungle Tree"},
|
2013-02-11 06:09:53 +01:00
|
|
|
{"fir", "Douglas Fir", "fir_cone", "Fir Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
|
2013-01-20 00:36:13 +01:00
|
|
|
}
|
|
|
|
|
2013-02-11 06:09:53 +01:00
|
|
|
moretrees.simple_trees = { "beech", "apple_tree", "oak", "sequoia", "palm", "pine", "willow", "rubber_tree"}
|
|
|
|
|
|
|
|
moretrees.leaves_list = {}
|
|
|
|
moretrees.trunks_list = {}
|
2013-01-20 19:38:23 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
for i in ipairs(trees) do
|
|
|
|
local treename = trees[i][1]
|
|
|
|
local treedesc = trees[i][2]
|
2013-02-11 06:09:53 +01:00
|
|
|
local fruit = trees[i][3]
|
|
|
|
local fruitdesc = trees[i][4]
|
|
|
|
local selbox = trees[i][5]
|
|
|
|
local vscale = trees[i][6]
|
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
|
|
|
|
minetest.register_node("moretrees:"..treename.."_trunk", {
|
2013-01-27 19:17:27 +01:00
|
|
|
description = treedesc.." Trunk",
|
2013-01-20 00:36:13 +01:00
|
|
|
tiles = {
|
2013-01-25 05:22:46 +01:00
|
|
|
"moretrees_"..treename.."_trunk_top.png",
|
|
|
|
"moretrees_"..treename.."_trunk_top.png",
|
|
|
|
"moretrees_"..treename.."_trunk.png"
|
2013-01-20 00:36:13 +01:00
|
|
|
},
|
|
|
|
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", {
|
2013-01-27 19:17:27 +01:00
|
|
|
description = "Sideways "..treedesc.." Trunk",
|
2013-01-22 02:31:28 +01:00
|
|
|
tiles = {
|
2013-01-25 05:22:46 +01:00
|
|
|
"moretrees_"..treename.."_trunk.png^[transformR90",
|
|
|
|
"moretrees_"..treename.."_trunk.png^[transformR90",
|
|
|
|
"moretrees_"..treename.."_trunk_top.png",
|
|
|
|
"moretrees_"..treename.."_trunk_top.png",
|
|
|
|
"moretrees_"..treename.."_trunk.png^[transformR90",
|
|
|
|
"moretrees_"..treename.."_trunk.png^[transformR90"
|
2013-01-22 02:31:28 +01:00
|
|
|
},
|
|
|
|
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-02-11 05:10:35 +01:00
|
|
|
paramtype2 = "facedir",
|
2013-01-22 02:31:28 +01:00
|
|
|
})
|
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
minetest.register_node("moretrees:"..treename.."_planks", {
|
2013-01-27 19:06:42 +01:00
|
|
|
description = treedesc.." Planks",
|
2013-01-20 00:36:13 +01:00
|
|
|
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", {
|
2013-01-27 19:17:27 +01:00
|
|
|
description = treedesc.." Sapling",
|
2013-01-20 00:36:13 +01:00
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"moretrees_"..treename.."_sapling.png"},
|
|
|
|
inventory_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",
|
|
|
|
tiles = { "moretrees_"..fruit..".png" },
|
2013-01-25 05:22:46 +01:00
|
|
|
inventory_image = "moretrees_"..fruit..".png^[transformR180",
|
|
|
|
wield_image = "moretrees_"..fruit..".png^[transformR180",
|
|
|
|
visual_scale = vscale,
|
2013-01-20 00:36:13 +01:00
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = selbox
|
|
|
|
},
|
2013-02-11 06:09:53 +01:00
|
|
|
groups = {fleshy=3,dig_immediate=3,flammable=2, attached_node=1},
|
2013-01-20 00:36:13 +01:00
|
|
|
sounds = default.node_sound_defaults(),
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2013-01-31 03:51:18 +01:00
|
|
|
-- player will get a sapling with 1/100 chance
|
|
|
|
-- player will get leaves only if he/she gets no saplings,
|
2013-01-25 05:22:46 +01:00
|
|
|
-- this is because max_items is 1
|
2013-01-20 00:36:13 +01:00
|
|
|
|
2013-01-25 05:22:46 +01:00
|
|
|
if treename ~= "jungletree" then
|
|
|
|
minetest.register_node("moretrees:"..treename.."_leaves", {
|
2013-01-27 19:17:27 +01:00
|
|
|
description = treedesc.." Leaves",
|
2013-01-25 05:22:46 +01:00
|
|
|
drawtype = "allfaces_optional",
|
|
|
|
tiles = { "moretrees_"..treename.."_leaves.png" },
|
|
|
|
paramtype = "light",
|
2013-02-11 06:09:53 +01:00
|
|
|
groups = {tree=1, snappy=3, flammable=2},
|
2013-01-25 05:22:46 +01:00
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
|
|
|
|
drop = {
|
|
|
|
max_items = 1,
|
|
|
|
items = {
|
2013-01-31 03:51:18 +01:00
|
|
|
{items = {"moretrees:"..treename.."_sapling"}, rarity = 100 },
|
2013-01-25 05:22:46 +01:00
|
|
|
{items = {"moretrees:"..treename.."_leaves"} }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end
|
2013-01-22 02:31:28 +01:00
|
|
|
|
2013-01-25 05:22:46 +01:00
|
|
|
table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_trunk")
|
|
|
|
table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_leaves")
|
2013-02-11 06:09:53 +01:00
|
|
|
table.insert(moretrees.trunks_list, "moretrees:"..treename.."_trunk")
|
2013-02-11 06:27:58 +01:00
|
|
|
if treename ~= "palm" then
|
|
|
|
table.insert(moretrees.leaves_list, "moretrees:"..treename.."_leaves")
|
|
|
|
end
|
|
|
|
|
2013-01-25 05:22:46 +01:00
|
|
|
end
|
2013-01-22 02:31:28 +01:00
|
|
|
|
2013-01-25 05:22:46 +01:00
|
|
|
-- Extra leaves for jungle trees:
|
2013-01-22 02:31:28 +01:00
|
|
|
|
2013-01-25 05:22:46 +01:00
|
|
|
local jungleleaves = {"green","yellow","red"}
|
|
|
|
local jungleleavesnames = {"Green", "Yellow", "Red"}
|
2013-01-20 00:36:13 +01:00
|
|
|
for color = 1, 3 do
|
2013-01-25 05:22:46 +01:00
|
|
|
local leave_name = "moretrees:jungletree_leaves_"..jungleleaves[color]
|
2013-01-20 00:36:13 +01:00
|
|
|
minetest.register_node(leave_name, {
|
2013-01-25 05:22:46 +01:00
|
|
|
description = "Jungle Tree Leaves ("..jungleleavesnames[color]..")",
|
2013-01-20 00:36:13 +01:00
|
|
|
drawtype = "allfaces_optional",
|
2013-01-25 05:22:46 +01:00
|
|
|
tiles = {"moretrees_jungletree_leaves_"..jungleleaves[color]..".png"},
|
2013-01-20 00:36:13 +01:00
|
|
|
paramtype = "light",
|
2013-01-25 05:22:46 +01:00
|
|
|
groups = {snappy=3, flammable=2},
|
2013-01-20 00:36:13 +01:00
|
|
|
drop = {
|
|
|
|
max_items = 1,
|
|
|
|
items = {
|
2013-01-31 03:51:18 +01:00
|
|
|
{items = {'moretrees:jungletree_sapling'}, rarity = 100 },
|
2013-01-25 05:22:46 +01:00
|
|
|
{items = {"moretrees:jungletree_leaves_"..jungleleaves[color]} }
|
2013-01-20 00:36:13 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
})
|
2013-02-11 06:09:53 +01:00
|
|
|
table.insert(moretrees.leaves_list, "moretrees:jungletree_leaves_"..jungleleaves[color])
|
2013-01-20 00:36:13 +01:00
|
|
|
end
|
|
|
|
|
2013-01-25 05:22:46 +01:00
|
|
|
-- Extra needles for firs
|
2013-01-20 00:36:13 +01:00
|
|
|
|
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-27 19:17:27 +01:00
|
|
|
description = "Douglas Fir Leaves (Bright)",
|
2013-01-22 02:50:41 +01:00
|
|
|
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-25 05:22:46 +01:00
|
|
|
groups = {snappy=3, flammable=2 },
|
2013-01-20 00:36:13 +01:00
|
|
|
drop = {
|
|
|
|
max_items = 1,
|
|
|
|
items = {
|
2013-01-31 03:51:18 +01:00
|
|
|
{items = {'moretrees:fir_sapling'}, rarity = 100 },
|
2013-01-25 05:22:46 +01:00
|
|
|
{items = {'moretrees:fir_leaves'} }
|
2013-01-20 00:36:13 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults()
|
|
|
|
})
|
2013-02-11 06:09:53 +01:00
|
|
|
table.insert(moretrees.leaves_list, "moretrees:fir_leaves_bright")
|
2013-01-20 00:36:13 +01:00
|
|
|
|
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-25 22:36:14 +01:00
|
|
|
minetest.register_alias("jungletree:sapling", "moretrees:jungletree_sapling")
|
2013-01-22 02:31:28 +01:00
|
|
|
|
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
|
|
|
|