From fad79d86b7182fb697e5c88232b0bd0b5958f8ad Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sat, 14 Sep 2013 22:44:32 -0400 Subject: add option to spawn saplings instead of fully-grown trees at mapgen time. Such saplings will grow very quickly into a tree, compared to a planted sapling. Defaults to spawning saplings. add custom jungle tree sapling, alias default one to that, so that moretrees will be able to grow its own jungle trees. fix tree density bug --- node_defs.lua | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 7 deletions(-) (limited to 'node_defs.lua') diff --git a/node_defs.lua b/node_defs.lua index b02a6a2..a71b5c3 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -27,7 +27,7 @@ for i in ipairs(moretrees.treelist) do local selbox = moretrees.treelist[i][5] local vscale = moretrees.treelist[i][6] - if treename ~= "jungletree" then -- the default game provides jungle tree nodes. + if treename ~= "jungletree" then -- the default game provides jungle tree trunk/planks nodes. minetest.register_node("moretrees:"..treename.."_trunk", { description = treedesc.." Trunk", @@ -65,6 +65,22 @@ for i in ipairs(moretrees.treelist) do sounds = default.node_sound_defaults(), }) + minetest.register_node("moretrees:"..treename.."_sapling_ongen", { + description = treedesc.." Sapling", + 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,not_in_creative_inventory=1}, + sounds = default.node_sound_defaults(), + drop = "moretrees:"..treename.."_sapling" + }) + -- player will get a sapling with 1/100 chance -- player will get leaves only if he/she gets no saplings, -- this is because max_items is 1 @@ -226,9 +242,49 @@ for i in ipairs(moretrees.treelist) do }) table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_trunk") + + if moretrees.spawn_saplings then + table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_sapling") + table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_sapling_ongen") + end end --- Extra leaves for jungle trees: +-- Extra nodes for jungle trees: + +minetest.register_node("moretrees:jungletree_sapling", { + description = "Jungle Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_junglesapling.png"}, + inventory_image = "default_junglesapling.png", + wield_image = "default_junglesapling.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_leaves_defaults(), +}) + +minetest.register_node("moretrees:jungletree_sapling_ongen", { + description = "Jungle Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_junglesapling.png"}, + inventory_image = "default_junglesapling.png", + wield_image = "default_junglesapling.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,not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + drop = "moretrees:jungletree_sapling" +}) local jungleleaves = {"green","yellow","red"} local jungleleavesnames = {"Green", "Yellow", "Red"} @@ -295,6 +351,13 @@ table.insert(moretrees.avoidnodes, "moretrees:jungletree_trunk") table.insert(moretrees.avoidnodes, "moretrees:fir_trunk") table.insert(moretrees.avoidnodes, "default:tree") +if moretrees.spawn_saplings then + table.insert(moretrees.avoidnodes, "snow:sapling_pine") + table.insert(moretrees.avoidnodes, "default:junglesapling") + table.insert(moretrees.avoidnodes, "moretrees:jungle_tree_sapling") + table.insert(moretrees.avoidnodes, "moretrees:jungle_tree_sapling_ongen") +end + -- "empty" (tapped) rubber tree nodes minetest.register_node("moretrees:rubber_tree_trunk_empty", { @@ -332,11 +395,7 @@ minetest.register_alias("farming_plus:rubber_leaves", "moretrees:rubber_tree_lea minetest.register_alias("farming_plus:rubber_sapling", "moretrees:rubber_tree_sapling") minetest.register_alias("technic:rubber_tree_sapling", "moretrees:rubber_tree_sapling") -minetest.register_alias("moretrees:jungletree_trunk", "default:jungletree") -minetest.register_alias("moretrees:jungletree_planks", "default:junglewood") -minetest.register_alias("moretrees:jungletree_sapling", "default:junglesapling") -minetest.register_alias("jungletree:sapling", "default:junglesapling") - +minetest.register_alias("default:junglesapling","moretrees:jungletree_sapling") minetest.register_alias("moretrees:jungletree_trunk_sideways", "moreblocks:horizontal_jungle_tree") minetest.register_alias("jungletree:leaves_green", "moretrees:jungletree_leaves_green") -- cgit v1.2.3