mirror of
https://github.com/mt-mods/plantlife_modpack.git
synced 2025-07-18 07:40:39 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@ -4,30 +4,44 @@
|
||||
-- TWiGS
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
local random = math.random
|
||||
local fakenode = {
|
||||
name = "default:stone", -- could be anything that's guaranteed to exist at mapgen time, and isn't buildable_to
|
||||
param1 = 0,
|
||||
param2 = 0
|
||||
}
|
||||
|
||||
abstract_trunks.place_twig = function(pos)
|
||||
local twig_size = random(1,27)
|
||||
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 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)
|
||||
|
||||
node_north = minetest.registered_nodes[node_north.name] and node_north or fakenode
|
||||
node_n_e = minetest.registered_nodes[node_n_e.name] and node_n_e or fakenode
|
||||
node_east = minetest.registered_nodes[node_east.name] and node_east or fakenode
|
||||
node_s_e = minetest.registered_nodes[node_s_e.name] and node_s_e or fakenode
|
||||
node_south = minetest.registered_nodes[node_south.name] and node_south or fakenode
|
||||
node_s_w = minetest.registered_nodes[node_s_w.name] and node_s_w or fakenode
|
||||
node_west = minetest.registered_nodes[node_west.name] and node_west or fakenode
|
||||
node_n_w = minetest.registered_nodes[node_n_w.name] and node_n_w or fakenode
|
||||
|
||||
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.swap_node(right_here, {name="trunks:twig_"..random(1,4), param2=random(0,3)})
|
||||
@ -357,12 +371,13 @@ 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 = random(1,21)
|
||||
local moss_type = math.random(1,21)
|
||||
local rot = math.random(0,3)
|
||||
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(on_ground, {name="trunks:moss_fungus", param2=random(0,3)})
|
||||
minetest.swap_node(on_ground, {name="trunks:moss_with_fungus_"..rot, param2=1})
|
||||
else
|
||||
minetest.swap_node(on_ground, {name="trunks:moss", param2=random(0,3)})
|
||||
minetest.swap_node(on_ground, {name="trunks:moss_plain_"..rot, param2=1})
|
||||
end
|
||||
|
||||
end
|
||||
@ -408,44 +423,49 @@ 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 = random(1,41)
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true,
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
local moss_type = math.random(1,41)
|
||||
local rot = math.random(0,3)
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(on_ground, {name="trunks:moss_fungus", param2=random(0,3) --[[1]]})
|
||||
minetest.swap_node(on_ground, {name="trunks:moss_with_fungus_"..rot, param2=1})
|
||||
elseif moss_type < 22 then
|
||||
minetest.swap_node(on_ground, {name="trunks:moss", param2=random(0,3) --[[1]]})
|
||||
minetest.swap_node(on_ground, {name="trunks:moss_plain_"..rot, param2=1})
|
||||
end
|
||||
end
|
||||
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 minetest.registered_nodes[node_north.name].buildable_to then
|
||||
local moss_type = math.random(1,31) -- cliche of more moss at north
|
||||
local rot = math.random(0,3)
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(at_side_n, {name="trunks:moss_fungus", param2=random(4,7)}) -- 5,4,6,7
|
||||
minetest.swap_node(at_side_n, {name="trunks:moss_with_fungus_"..rot, param2=5})
|
||||
elseif moss_type < 22 then
|
||||
minetest.swap_node(at_side_n, {name="trunks:moss", param2=random(4,7)})
|
||||
minetest.swap_node(at_side_n, {name="trunks:moss_plain_"..rot, param2=5})
|
||||
end
|
||||
end
|
||||
local moss_type = random(1,41)
|
||||
if minetest.registered_nodes[node_east.name].buildable_to then -- instead of check_air = true,
|
||||
if minetest.registered_nodes[node_east.name].buildable_to then
|
||||
local moss_type = math.random(1,41)
|
||||
local rot = math.random(0,3)
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(at_side_e, {name="trunks:moss_fungus", param2=random(12,15)})
|
||||
minetest.swap_node(at_side_e, {name="trunks:moss_with_fungus_"..rot, param2=3})
|
||||
elseif moss_type < 22 then
|
||||
minetest.swap_node(at_side_e, {name="trunks:moss", param2=random(12,15)})
|
||||
minetest.swap_node(at_side_e, {name="trunks:moss_plain_"..rot, param2=3})
|
||||
end
|
||||
end
|
||||
local moss_type = random(1,41)
|
||||
if minetest.registered_nodes[node_south.name].buildable_to then -- instead of check_air = true,
|
||||
if minetest.registered_nodes[node_south.name].buildable_to then
|
||||
local moss_type = math.random(1,41)
|
||||
local rot = math.random(0,3)
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(at_side_s, {name="trunks:moss_fungus", param2=random(8,11)})
|
||||
minetest.swap_node(at_side_s, {name="trunks:moss_with_fungus_"..rot, param2=4})
|
||||
elseif moss_type < 22 then
|
||||
minetest.swap_node(at_side_s, {name="trunks:moss", param2=random(8,11)})
|
||||
minetest.swap_node(at_side_s, {name="trunks:moss_plain_"..rot, param2=4})
|
||||
end
|
||||
end
|
||||
local moss_type = random(1,41)
|
||||
if minetest.registered_nodes[node_west.name].buildable_to then -- instead of check_air = true,
|
||||
if minetest.registered_nodes[node_west.name].buildable_to then
|
||||
local moss_type = math.random(1,41)
|
||||
local rot = math.random(0,3)
|
||||
if moss_type == 1 then
|
||||
minetest.swap_node(at_side_w, {name="trunks:moss_fungus", param2=random(16,19)})
|
||||
minetest.swap_node(at_side_w, {name="trunks:moss_with_fungus_"..rot, param2=2})
|
||||
elseif moss_type < 22 then
|
||||
minetest.swap_node(at_side_w, {name="trunks:moss", param2=random(16,19)})
|
||||
minetest.swap_node(at_side_w, {name="trunks:moss_plain_"..rot, param2=2})
|
||||
end
|
||||
end
|
||||
--end
|
||||
|
Reference in New Issue
Block a user