summaryrefslogtreecommitdiff
path: root/trunks
diff options
context:
space:
mode:
Diffstat (limited to 'trunks')
-rw-r--r--trunks/generating.lua160
-rw-r--r--trunks/init.lua2
-rw-r--r--trunks/nodes.lua18
3 files changed, 90 insertions, 90 deletions
diff --git a/trunks/generating.lua b/trunks/generating.lua
index e544a21..6595f2b 100644
--- a/trunks/generating.lua
+++ b/trunks/generating.lua
@@ -14,38 +14,38 @@ end
-----------------------------------------------------------------------------------------------
abstract_trunks.place_twig = function(pos)
- local twig_size = math.random(1,27)
-
- local right_here = {x=pos.x , y=pos.y+1, z=pos.z }
- local north = {x=pos.x , y=pos.y+1, z=pos.z+1}
- local north_east = {x=pos.x+1, y=pos.y+1, z=pos.z+1}
- local east = {x=pos.x+1, y=pos.y+1, z=pos.z }
- local south_east = {x=pos.x+1, y=pos.y+1, z=pos.z-1}
- local south = {x=pos.x , y=pos.y+1, z=pos.z-1}
- local south_west = {x=pos.x-1, y=pos.y+1, z=pos.z-1}
- local west = {x=pos.x-1, y=pos.y+1, z=pos.z }
- local north_west = {x=pos.x-1, y=pos.y+1, z=pos.z+1}
-
- local node_here = minetest.get_node(right_here)
- local node_north = minetest.get_node(north)
- local node_n_e = minetest.get_node(north_east)
- local node_east = minetest.get_node(east)
- local node_s_e = minetest.get_node(south_east)
- local node_south = minetest.get_node(south)
- local node_s_w = minetest.get_node(south_west)
- local node_west = minetest.get_node(west)
- local node_n_w = minetest.get_node(north_west)
--- small twigs
+ local twig_size = math.random(1,27)
+
+ local right_here = {x=pos.x , y=pos.y+1, z=pos.z }
+ local north = {x=pos.x , y=pos.y+1, z=pos.z+1}
+ local north_east = {x=pos.x+1, y=pos.y+1, z=pos.z+1}
+ local east = {x=pos.x+1, y=pos.y+1, z=pos.z }
+ local south_east = {x=pos.x+1, y=pos.y+1, z=pos.z-1}
+ local south = {x=pos.x , y=pos.y+1, z=pos.z-1}
+ local south_west = {x=pos.x-1, y=pos.y+1, z=pos.z-1}
+ local west = {x=pos.x-1, y=pos.y+1, z=pos.z }
+ local north_west = {x=pos.x-1, y=pos.y+1, z=pos.z+1}
+
+ local node_here = minetest.get_node(right_here)
+ local node_north = minetest.get_node(north)
+ local node_n_e = minetest.get_node(north_east)
+ local node_east = minetest.get_node(east)
+ local node_s_e = minetest.get_node(south_east)
+ local node_south = minetest.get_node(south)
+ local node_s_w = minetest.get_node(south_west)
+ local node_west = minetest.get_node(west)
+ local node_n_w = minetest.get_node(north_west)
+-- small twigs
if twig_size <= 16 then
minetest.set_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)})
end
--- big twigs
+-- big twigs
if Big_Twigs == true then
--- big twig 1
+-- big twig 1
if twig_size == 17 then
if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1}).name].buildable_to
or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name].buildable_to) then
-
+
if minetest.registered_nodes[node_here.name].buildable_to then
minetest.set_node(right_here, {name="trunks:twig_5"})
end
@@ -53,13 +53,13 @@ abstract_trunks.place_twig = function(pos)
minetest.set_node(north_east, {name="trunks:twig_7"})
end
if minetest.registered_nodes[node_east.name].buildable_to then
- minetest.set_node(east, {name="trunks:twig_8"})
+ minetest.set_node(east, {name="trunks:twig_8"})
end
end
elseif twig_size == 18 then
if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to
or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name].buildable_to) then
-
+
if minetest.registered_nodes[node_here.name].buildable_to then
minetest.set_node(right_here, {name="trunks:twig_5", param2=1})
end
@@ -67,13 +67,13 @@ abstract_trunks.place_twig = function(pos)
minetest.set_node(south_east, {name="trunks:twig_7", param2=1})
end
if minetest.registered_nodes[node_south.name].buildable_to then
- minetest.set_node(south, {name="trunks:twig_8", param2=1})
+ minetest.set_node(south, {name="trunks:twig_8", param2=1})
end
end
elseif twig_size == 19 then
if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to
or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name].buildable_to) then
-
+
if minetest.registered_nodes[node_here.name].buildable_to then
minetest.set_node(right_here, {name="trunks:twig_5", param2=2})
end
@@ -81,13 +81,13 @@ abstract_trunks.place_twig = function(pos)
minetest.set_node(south_west, {name="trunks:twig_7", param2=2})
end
if minetest.registered_nodes[node_west.name].buildable_to then
- minetest.set_node(west, {name="trunks:twig_8", param2=2})
+ minetest.set_node(west, {name="trunks:twig_8", param2=2})
end
end
elseif twig_size == 20 then
if not (minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1}).name].buildable_to
or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name].buildable_to) then
-
+
if minetest.registered_nodes[node_here.name].buildable_to then
minetest.set_node(right_here, {name="trunks:twig_5", param2=3})
end
@@ -95,19 +95,19 @@ abstract_trunks.place_twig = function(pos)
minetest.set_node(north_west, {name="trunks:twig_7", param2=3})
end
if minetest.registered_nodes[node_north.name].buildable_to then
- minetest.set_node(north, {name="trunks:twig_8", param2=3})
+ minetest.set_node(north, {name="trunks:twig_8", param2=3})
end
end
--- big twig 2
+-- big twig 2
elseif twig_size == 21 then
if not (minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name].buildable_to
or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1}).name].buildable_to) then
-
+
if minetest.registered_nodes[node_here.name].buildable_to then
minetest.set_node(right_here, {name="trunks:twig_9"})
end
if minetest.registered_nodes[node_north.name].buildable_to then
- minetest.set_node(north, {name="trunks:twig_10"})
+ minetest.set_node(north, {name="trunks:twig_10"})
end
if minetest.registered_nodes[node_n_e.name].buildable_to then
minetest.set_node(north_east, {name="trunks:twig_11"})
@@ -116,12 +116,12 @@ abstract_trunks.place_twig = function(pos)
elseif twig_size == 22 then
if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name].buildable_to
or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to) then
-
+
if minetest.registered_nodes[node_here.name].buildable_to then
minetest.set_node(right_here, {name="trunks:twig_9", param2=1})
end
if minetest.registered_nodes[node_east.name].buildable_to then
- minetest.set_node(east, {name="trunks:twig_10", param2=1})
+ minetest.set_node(east, {name="trunks:twig_10", param2=1})
end
if minetest.registered_nodes[node_s_e.name].buildable_to then
minetest.set_node(south_east, {name="trunks:twig_11", param2=1})
@@ -130,12 +130,12 @@ abstract_trunks.place_twig = function(pos)
elseif twig_size == 23 then
if not (minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name].buildable_to
or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z-1}).name].buildable_to) then
-
+
if minetest.registered_nodes[node_here.name].buildable_to then
minetest.set_node(right_here, {name="trunks:twig_9", param2=2})
end
if minetest.registered_nodes[node_south.name].buildable_to then
- minetest.set_node(south, {name="trunks:twig_10", param2=2})
+ minetest.set_node(south, {name="trunks:twig_10", param2=2})
end
if minetest.registered_nodes[node_s_w.name].buildable_to then
minetest.set_node(south_west, {name="trunks:twig_11", param2=2})
@@ -144,12 +144,12 @@ abstract_trunks.place_twig = function(pos)
elseif twig_size == 24 then
if not (minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name].buildable_to
or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1}).name].buildable_to) then
-
+
if minetest.registered_nodes[node_here.name].buildable_to then
minetest.set_node(right_here, {name="trunks:twig_9", param2=3})
end
if minetest.registered_nodes[node_west.name].buildable_to then
- minetest.set_node(west, {name="trunks:twig_10", param2=3})
+ minetest.set_node(west, {name="trunks:twig_10", param2=3})
end
if minetest.registered_nodes[node_n_w.name].buildable_to then
minetest.set_node(north_west, {name="trunks:twig_11", param2=3})
@@ -199,12 +199,12 @@ end
-- TRuNKS
-----------------------------------------------------------------------------------------------
local TRuNKS = {
--- MoD TRuNK NR
- {"default", "tree", 1},
+-- MoD TRuNK NR
+ {"default", "tree", 1},
{"default", "jungletree", 2},
{"default", "pine_tree", 12},
- {"trees", "tree_conifer", 3},
+ {"trees", "tree_conifer", 3},
{"trees", "tree_mangrove", 4},
{"trees", "tree_palm", 5},
@@ -223,11 +223,11 @@ local TRuNKS = {
if Horizontal_Trunks == true then -- see settings.txt
for i in pairs(TRuNKS) do
- local MoD = TRuNKS[i][1]
- local TRuNK = TRuNKS[i][2]
- local NR = TRuNKS[i][3]
+ local MoD = TRuNKS[i][1]
+ local TRuNK = TRuNKS[i][2]
+ local NR = TRuNKS[i][3]
local trunkname = MoD..":"..TRuNK
- if minetest.get_modpath(MoD) ~= nil
+ if minetest.get_modpath(MoD) ~= nil
and NR < 6 -- moretrees trunks allready have facedir
and minetest.registered_nodes[trunkname] then -- the node being called exists.
temptrunk = clone_node(trunkname)
@@ -236,9 +236,9 @@ for i in pairs(TRuNKS) do
end
end
end
-
+
abstract_trunks.place_trunk = function(pos)
-
+
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
local north = {x=pos.x, y=pos.y+1, z=pos.z+1}
local north2 = {x=pos.x, y=pos.y+1, z=pos.z+2}
@@ -248,7 +248,7 @@ abstract_trunks.place_trunk = function(pos)
local west2 = {x=pos.x-2, y=pos.y+1, z=pos.z}
local east = {x=pos.x+1, y=pos.y+1, z=pos.z}
local east2 = {x=pos.x+2, y=pos.y+1, z=pos.z}
-
+
local node_here = minetest.get_node(right_here)
local node_north = minetest.get_node(north)
local node_north2 = minetest.get_node(north2)
@@ -260,11 +260,11 @@ abstract_trunks.place_trunk = function(pos)
local node_east2 = minetest.get_node(east2)
if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true,
for i in pairs(TRuNKS) do
- local MoD = TRuNKS[i][1]
- local TRuNK = TRuNKS[i][2]
- local NR = TRuNKS[i][3]
- local chance = math.random(1, 17)
- local length = math.random(3,5)
+ local MoD = TRuNKS[i][1]
+ local TRuNK = TRuNKS[i][2]
+ local NR = TRuNKS[i][3]
+ local chance = math.random(1, 17)
+ local length = math.random(3,5)
if chance == NR then
local trunk_type = math.random(1,3)
if trunk_type == 1 then
@@ -278,7 +278,7 @@ abstract_trunks.place_trunk = function(pos)
if minetest.registered_nodes[node_north.name].buildable_to then
minetest.set_node(north, {name=MoD..":"..TRuNK, param2=4})
end
-
+
if length >= 4 and minetest.registered_nodes[node_north2.name].buildable_to then
minetest.set_node(north2, {name=MoD..":"..TRuNK, param2=4})
end
@@ -365,13 +365,13 @@ if Moss_on_ground == true then
abstract_trunks.grow_moss_on_ground = function(pos)
local on_ground = {x=pos.x, y=pos.y+1, z=pos.z}
local moss_type = math.random(1,21)
-
+
if moss_type == 1 then
minetest.set_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3)})
else
minetest.set_node(on_ground, {name="trunks:moss", param2=math.random(0,3)})
end
-
+
end
biome_lib:register_generate_plant({
@@ -406,14 +406,14 @@ abstract_trunks.grow_moss_on_trunk = function(pos)
local at_side_s = {x=pos.x, y=pos.y, z=pos.z-1}
local at_side_w = {x=pos.x-1, y=pos.y, z=pos.z}
local undrneath = {x=pos.x, y=pos.y-1, z=pos.z}
-
+
local node_here = minetest.get_node(on_ground)
local node_north = minetest.get_node(at_side_n)
local node_east = minetest.get_node(at_side_e)
local node_south = minetest.get_node(at_side_s)
local node_west = minetest.get_node(at_side_w)
local node_under = minetest.get_node(undrneath)
-
+
--if minetest.get_item_group(node_under.name, "tree") < 1 then
local moss_type = math.random(1,41)
if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true,
@@ -491,32 +491,32 @@ biome_lib:register_generate_plant({
end
-----------------------------------------------------------------------------------------------
--- RooTS
+-- RooTS
-----------------------------------------------------------------------------------------------
if Roots == true then -- see settings.txt
abstract_trunks.grow_roots = function(pos)
- local twig_size = math.random(1,27)
-
- local right_here = {x=pos.x , y=pos.y , z=pos.z }
- local below = {x=pos.x , y=pos.y-1, z=pos.z }
- local north = {x=pos.x , y=pos.y , z=pos.z+1}
- local east = {x=pos.x+1, y=pos.y , z=pos.z }
- local south = {x=pos.x , y=pos.y , z=pos.z-1}
- local west = {x=pos.x-1, y=pos.y , z=pos.z }
-
- local node_here = minetest.get_node(right_here)
+ local twig_size = math.random(1,27)
+
+ local right_here = {x=pos.x , y=pos.y , z=pos.z }
+ local below = {x=pos.x , y=pos.y-1, z=pos.z }
+ local north = {x=pos.x , y=pos.y , z=pos.z+1}
+ local east = {x=pos.x+1, y=pos.y , z=pos.z }
+ local south = {x=pos.x , y=pos.y , z=pos.z-1}
+ local west = {x=pos.x-1, y=pos.y , z=pos.z }
+
+ local node_here = minetest.get_node(right_here)
local node_below = minetest.get_node(below)
- local node_north = minetest.get_node(north)
- local node_east = minetest.get_node(east)
- local node_south = minetest.get_node(south)
- local node_west = minetest.get_node(west)
+ local node_north = minetest.get_node(north)
+ local node_east = minetest.get_node(east)
+ local node_south = minetest.get_node(south)
+ local node_west = minetest.get_node(west)
for i in pairs(TRuNKS) do
- local MoD = TRuNKS[i][1]
- local TRuNK = TRuNKS[i][2]
- if minetest.get_modpath(MoD) ~= nil
- and node_here.name == MoD..":"..TRuNK
+ local MoD = TRuNKS[i][1]
+ local TRuNK = TRuNKS[i][2]
+ if minetest.get_modpath(MoD) ~= nil
+ and node_here.name == MoD..":"..TRuNK
and string.find(node_below.name, "dirt")
and node_here.param2 == 0 then
if minetest.registered_nodes[node_north.name].buildable_to then
diff --git a/trunks/init.lua b/trunks/init.lua
index 899f6a9..727e484 100644
--- a/trunks/init.lua
+++ b/trunks/init.lua
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------------------------------
local title = "Trunks"
-local version = "0.1.4"
+local version = "0.1.4"
local mname = "trunks"
-----------------------------------------------------------------------------------------------
-- Code by Mossmanikin & Neuromancer
diff --git a/trunks/nodes.lua b/trunks/nodes.lua
index 38c2212..d46d2e5 100644
--- a/trunks/nodes.lua
+++ b/trunks/nodes.lua
@@ -217,10 +217,10 @@ if Auto_Roof_Corner == true then
chance = 1,
action = function(pos)
- local node_east = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z })
- local node_west = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z })
- local node_north = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
- local node_south = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
+ local node_east = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z })
+ local node_west = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z })
+ local node_north = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
+ local node_south = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
-- corner 1
if ((node_west.name == roof and node_west.param2 == 0)
or (node_west.name == corner and node_west.param2 == 1))
@@ -302,8 +302,8 @@ local roots_cube = {-2/16, -1/2, -3/16, 2/16, 1/16, 1/2}
local roots_sheet = {0, -1/2, -1/2, 0, 1/16, 1/2}
local TRuNKS = {
--- MoD TRuNK
- {"default", "tree" },
+-- MoD TRuNK
+ {"default", "tree" },
{"default", "jungletree" },
{"default", "pine_tree" },
@@ -325,8 +325,8 @@ local TRuNKS = {
}
for i in pairs(TRuNKS) do
- local MoD = TRuNKS[i][1]
- local TRuNK = TRuNKS[i][2]
+ local MoD = TRuNKS[i][1]
+ local TRuNK = TRuNKS[i][2]
if minetest.get_modpath(MoD) ~= nil then
local node = minetest.registered_nodes[MoD..":"..TRuNK]
@@ -361,7 +361,7 @@ for i in pairs(TRuNKS) do
})
else
- print(string.format("[Trunks] warning: tree type '%s:%s' not found", MoD, TRuNK))
+ minetest.log("error", string.format("[Trunks] warning: tree type '%s:%s' not found", MoD, TRuNK))
end
end
end