summaryrefslogtreecommitdiff
path: root/node_defs.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-09-14 22:44:32 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-09-14 22:44:32 -0400
commitfad79d86b7182fb697e5c88232b0bd0b5958f8ad (patch)
treeeee7cfc3d62db2ae646ac207bf9cf920138de977 /node_defs.lua
parent258f33e42a2806b50ca5687357bf30b8ed540b07 (diff)
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
Diffstat (limited to 'node_defs.lua')
-rw-r--r--node_defs.lua73
1 files changed, 66 insertions, 7 deletions
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")