mirror of
https://github.com/mt-mods/plantlife_modpack.git
synced 2025-07-18 07:40:39 +02:00
[trunks] Tidy code and disable auto roof corners ABM
This commit is contained in:
@ -4,8 +4,10 @@
|
||||
-- TWiGS
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
local random = math.random
|
||||
|
||||
abstract_trunks.place_twig = function(pos)
|
||||
local twig_size = math.random(1,27)
|
||||
local twig_size = 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}
|
||||
@ -28,7 +30,7 @@ abstract_trunks.place_twig = function(pos)
|
||||
local node_n_w = minetest.get_node(north_west)
|
||||
-- small twigs
|
||||
if twig_size <= 16 then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)})
|
||||
minetest.swap_node(right_here, {name="trunks:twig_"..random(1,4), param2=random(0,3)})
|
||||
end
|
||||
-- big twigs
|
||||
if Big_Twigs == true then
|
||||
@ -147,7 +149,7 @@ abstract_trunks.place_twig = function(pos)
|
||||
end
|
||||
end
|
||||
elseif twig_size <= 25 then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_"..math.random(12,13), param2=math.random(0,3)})
|
||||
minetest.swap_node(right_here, {name="trunks:twig_"..random(12,13), param2=random(0,3)})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -254,10 +256,10 @@ abstract_trunks.place_trunk = function(pos)
|
||||
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 chance = random(1, 17)
|
||||
local length = random(3,5)
|
||||
if chance == NR then
|
||||
local trunk_type = math.random(1,3)
|
||||
local trunk_type = random(1,3)
|
||||
if trunk_type == 1 then
|
||||
if minetest.get_modpath(MoD) ~= nil then
|
||||
minetest.swap_node(right_here, {name=MoD..":"..TRuNK})
|
||||
@ -355,12 +357,12 @@ biome_lib:register_generate_plant({
|
||||
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)
|
||||
local moss_type = random(1,21)
|
||||
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3)})
|
||||
minetest.swap_node(on_ground, {name="trunks:moss_fungus", param2=random(0,3)})
|
||||
else
|
||||
minetest.swap_node(on_ground, {name="trunks:moss", param2=math.random(0,3)})
|
||||
minetest.swap_node(on_ground, {name="trunks:moss", param2=random(0,3)})
|
||||
end
|
||||
|
||||
end
|
||||
@ -406,44 +408,44 @@ abstract_trunks.grow_moss_on_trunk = function(pos)
|
||||
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)
|
||||
local moss_type = random(1,41)
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true,
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3) --[[1]]})
|
||||
minetest.swap_node(on_ground, {name="trunks:moss_fungus", param2=random(0,3) --[[1]]})
|
||||
elseif moss_type < 22 then
|
||||
minetest.swap_node(on_ground, {name="trunks:moss", param2=math.random(0,3) --[[1]]})
|
||||
minetest.swap_node(on_ground, {name="trunks:moss", param2=random(0,3) --[[1]]})
|
||||
end
|
||||
end
|
||||
local moss_type = math.random(1,31) -- cliche of more moss at north
|
||||
local moss_type = random(1,31) -- cliche of more moss at north
|
||||
if minetest.registered_nodes[node_north.name].buildable_to then -- instead of check_air = true,
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(at_side_n, {name="trunks:moss_fungus", param2=math.random(4,7)}) -- 5,4,6,7
|
||||
minetest.swap_node(at_side_n, {name="trunks:moss_fungus", param2=random(4,7)}) -- 5,4,6,7
|
||||
elseif moss_type < 22 then
|
||||
minetest.swap_node(at_side_n, {name="trunks:moss", param2=math.random(4,7)})
|
||||
minetest.swap_node(at_side_n, {name="trunks:moss", param2=random(4,7)})
|
||||
end
|
||||
end
|
||||
local moss_type = math.random(1,41)
|
||||
local moss_type = random(1,41)
|
||||
if minetest.registered_nodes[node_east.name].buildable_to then -- instead of check_air = true,
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(at_side_e, {name="trunks:moss_fungus", param2=math.random(12,15)})
|
||||
minetest.swap_node(at_side_e, {name="trunks:moss_fungus", param2=random(12,15)})
|
||||
elseif moss_type < 22 then
|
||||
minetest.swap_node(at_side_e, {name="trunks:moss", param2=math.random(12,15)})
|
||||
minetest.swap_node(at_side_e, {name="trunks:moss", param2=random(12,15)})
|
||||
end
|
||||
end
|
||||
local moss_type = math.random(1,41)
|
||||
local moss_type = random(1,41)
|
||||
if minetest.registered_nodes[node_south.name].buildable_to then -- instead of check_air = true,
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(at_side_s, {name="trunks:moss_fungus", param2=math.random(8,11)})
|
||||
minetest.swap_node(at_side_s, {name="trunks:moss_fungus", param2=random(8,11)})
|
||||
elseif moss_type < 22 then
|
||||
minetest.swap_node(at_side_s, {name="trunks:moss", param2=math.random(8,11)})
|
||||
minetest.swap_node(at_side_s, {name="trunks:moss", param2=random(8,11)})
|
||||
end
|
||||
end
|
||||
local moss_type = math.random(1,41)
|
||||
local moss_type = random(1,41)
|
||||
if minetest.registered_nodes[node_west.name].buildable_to then -- instead of check_air = true,
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(at_side_w, {name="trunks:moss_fungus", param2=math.random(16,19)})
|
||||
minetest.swap_node(at_side_w, {name="trunks:moss_fungus", param2=random(16,19)})
|
||||
elseif moss_type < 22 then
|
||||
minetest.swap_node(at_side_w, {name="trunks:moss", param2=math.random(16,19)})
|
||||
minetest.swap_node(at_side_w, {name="trunks:moss", param2=random(16,19)})
|
||||
end
|
||||
end
|
||||
--end
|
||||
@ -487,7 +489,7 @@ end
|
||||
if Roots == true then -- see settings.txt
|
||||
|
||||
abstract_trunks.grow_roots = function(pos)
|
||||
local twig_size = math.random(1,27)
|
||||
local twig_size = 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 }
|
||||
|
Reference in New Issue
Block a user