get rid of settings in trunks
This commit is contained in:
parent
1e6260e2ad
commit
635060032b
|
@ -2,8 +2,11 @@ unused_args = false
|
|||
allow_defined_top = true
|
||||
max_line_length = 185
|
||||
|
||||
exclude_files = {".luacheckrc"}
|
||||
|
||||
globals = {
|
||||
"biome_lib", "abstract_dryplants",
|
||||
"bushes_classic", "abstract_trunks",
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
|
@ -14,4 +17,5 @@ read_globals = {
|
|||
|
||||
"default",
|
||||
"moretrees",
|
||||
"dump",
|
||||
}
|
||||
|
|
|
@ -29,8 +29,6 @@ abstract_trunks.place_twig = function(pos)
|
|||
if twig_size <= 16 then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)})
|
||||
end
|
||||
-- big twigs
|
||||
if Big_Twigs == true then
|
||||
-- big twig 1
|
||||
if twig_size == 17 then
|
||||
if not (check_node_buildable_to({x=pos.x+1,y=pos.y,z=pos.z+1})
|
||||
|
@ -148,14 +146,12 @@ abstract_trunks.place_twig = function(pos)
|
|||
elseif twig_size <= 25 then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_"..math.random(12,13), param2=math.random(0,3)})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if Twigs_on_ground == true then
|
||||
biome_lib.register_on_generate({
|
||||
surface = {"default:dirt_with_grass"},
|
||||
max_count = Twigs_on_ground_Max_Count,
|
||||
rarity = Twigs_on_ground_Rarity,
|
||||
max_count = 640,
|
||||
rarity = 66,
|
||||
min_elevation = 1,
|
||||
max_elevation = 40,
|
||||
near_nodes = {"group:tree","ferns:fern_03","ferns:fern_02","ferns:fern_01"},
|
||||
|
@ -166,13 +162,11 @@ biome_lib.register_on_generate({
|
|||
},
|
||||
abstract_trunks.place_twig
|
||||
)
|
||||
end
|
||||
|
||||
if Twigs_on_water == true then
|
||||
biome_lib.register_on_generate({
|
||||
surface = {"default:water_source"},
|
||||
max_count = Twigs_on_water_Max_Count,
|
||||
rarity = Twigs_on_water_Rarity,
|
||||
max_count = 320,
|
||||
rarity = 33,
|
||||
min_elevation = 1,
|
||||
max_elevation = 40,
|
||||
near_nodes = {"group:tree"},
|
||||
|
@ -183,7 +177,6 @@ biome_lib.register_on_generate({
|
|||
},
|
||||
abstract_trunks.place_twig
|
||||
)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- TRuNKS
|
||||
|
@ -211,7 +204,6 @@ local TRuNKS = {
|
|||
{"moretrees", "willow_trunk", 17},
|
||||
}
|
||||
|
||||
if Horizontal_Trunks == true then -- see settings.txt
|
||||
for i in pairs(TRuNKS) do
|
||||
local MoD = TRuNKS[i][1]
|
||||
local TRuNK = TRuNKS[i][2]
|
||||
|
@ -225,7 +217,6 @@ for i in pairs(TRuNKS) do
|
|||
minetest.register_node(":"..trunkname, temptrunk)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
abstract_trunks.place_trunk = function(pos)
|
||||
|
||||
|
@ -254,7 +245,7 @@ abstract_trunks.place_trunk = function(pos)
|
|||
else
|
||||
minetest.swap_node(right_here, {name="default:tree"})
|
||||
end
|
||||
elseif trunk_type == 2 and Horizontal_Trunks == true then
|
||||
elseif trunk_type == 2 then
|
||||
if minetest.get_modpath(MoD) ~= nil then
|
||||
if check_node_buildable_to(north) then
|
||||
minetest.swap_node(north, {name=MoD..":"..TRuNK, param2=4})
|
||||
|
@ -286,7 +277,7 @@ abstract_trunks.place_trunk = function(pos)
|
|||
minetest.swap_node(south2, {name="default:tree", param2=4})
|
||||
end
|
||||
end
|
||||
elseif trunk_type == 3 and Horizontal_Trunks == true then
|
||||
elseif trunk_type == 3 then
|
||||
if minetest.get_modpath(MoD) ~= nil then
|
||||
if check_node_buildable_to(west) then
|
||||
minetest.swap_node(west, {name=MoD..":"..TRuNK, param2=12})
|
||||
|
@ -324,8 +315,8 @@ end
|
|||
|
||||
biome_lib.register_on_generate({
|
||||
surface = {"default:dirt_with_grass"},
|
||||
max_count = Trunks_Max_Count, -- 320,
|
||||
rarity = Trunks_Rarity, -- 99,
|
||||
max_count = 320, -- 320,
|
||||
rarity = 99, -- 99,
|
||||
min_elevation = 1,
|
||||
max_elevation = 40,
|
||||
avoid_nodes = {"group:tree"},
|
||||
|
@ -342,7 +333,6 @@ biome_lib.register_on_generate({
|
|||
-----------------------------------------------------------------------------------------------
|
||||
-- MoSS & FuNGuS -- on ground
|
||||
-----------------------------------------------------------------------------------------------
|
||||
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)
|
||||
|
@ -358,8 +348,8 @@ end
|
|||
|
||||
biome_lib.register_on_generate({
|
||||
surface = {"default:dirt_with_grass"},
|
||||
max_count = Moss_on_ground_Max_Count,
|
||||
rarity = Moss_on_ground_Rarity,
|
||||
max_count = 400,
|
||||
rarity = 79,
|
||||
min_elevation = 1,
|
||||
max_elevation = 40,
|
||||
near_nodes = {
|
||||
|
@ -375,12 +365,10 @@ biome_lib.register_on_generate({
|
|||
},
|
||||
abstract_trunks.grow_moss_on_ground
|
||||
)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- MoSS & FuNGuS -- on trunks
|
||||
-----------------------------------------------------------------------------------------------
|
||||
if Moss_on_trunk == true then
|
||||
abstract_trunks.grow_moss_on_trunk = function(pos)
|
||||
local on_ground = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local at_side_n = {x=pos.x, y=pos.y, z=pos.z+1}
|
||||
|
@ -458,8 +446,8 @@ biome_lib.register_on_generate({
|
|||
"moretrees:willow_trunk",
|
||||
"default:mossycobble"
|
||||
},
|
||||
max_count = Moss_on_trunk_Max_Count,
|
||||
rarity = Moss_on_trunk_Rarity,
|
||||
max_count = 640,
|
||||
rarity = 24,
|
||||
min_elevation = 1,
|
||||
max_elevation = 40,
|
||||
plantlife_limit = -0.9,
|
||||
|
@ -467,13 +455,10 @@ biome_lib.register_on_generate({
|
|||
},
|
||||
"abstract_trunks.grow_moss_on_trunk"
|
||||
)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- RooTS
|
||||
-----------------------------------------------------------------------------------------------
|
||||
if Roots == true then -- see settings.txt
|
||||
|
||||
abstract_trunks.grow_roots = function(pos)
|
||||
local right_here = {x=pos.x , y=pos.y , z=pos.z }
|
||||
local below = {x=pos.x , y=pos.y-1, z=pos.z }
|
||||
|
@ -523,5 +508,3 @@ biome_lib.register_on_generate({
|
|||
},
|
||||
"abstract_trunks.grow_roots"
|
||||
)
|
||||
|
||||
end
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
abstract_trunks = {}
|
||||
|
||||
dofile(minetest.get_modpath("trunks").."/trunks_settings.txt")
|
||||
dofile(minetest.get_modpath("trunks").."/generating.lua")
|
||||
dofile(minetest.get_modpath("trunks").."/nodes.lua")
|
||||
dofile(minetest.get_modpath("trunks").."/crafting.lua")
|
||||
|
||||
abstract_trunks.loaded = true
|
||||
|
|
150
trunks/nodes.lua
150
trunks/nodes.lua
|
@ -239,98 +239,93 @@ minetest.register_node("trunks:twigs_roof_corner_2", {
|
|||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
if Auto_Roof_Corner == true then
|
||||
local roof = "trunks:twigs_roof"
|
||||
local corner = "trunks:twigs_roof_corner"
|
||||
local corner_2 = "trunks:twigs_roof_corner_2"
|
||||
|
||||
local roof = "trunks:twigs_roof"
|
||||
local corner = "trunks:twigs_roof_corner"
|
||||
local corner_2 = "trunks:twigs_roof_corner_2"
|
||||
minetest.register_abm({
|
||||
nodenames = {roof},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {roof},
|
||||
interval = 1,
|
||||
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})
|
||||
-- corner 1
|
||||
if ((node_west.name == roof and node_west.param2 == 0)
|
||||
or (node_west.name == corner and node_west.param2 == 1))
|
||||
and ((node_north.name == roof and node_north.param2 == 3)
|
||||
or (node_north.name == corner and node_north.param2 == 3))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner, param2=0})
|
||||
end
|
||||
|
||||
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))
|
||||
and ((node_north.name == roof and node_north.param2 == 3)
|
||||
or (node_north.name == corner and node_north.param2 == 3))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner, param2=0})
|
||||
end
|
||||
if ((node_north.name == roof and node_north.param2 == 1)
|
||||
or (node_north.name == corner and node_north.param2 == 2))
|
||||
and ((node_east.name == roof and node_east.param2 == 0)
|
||||
or (node_east.name == corner and node_east.param2 == 0))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner, param2=1})
|
||||
end
|
||||
|
||||
if ((node_north.name == roof and node_north.param2 == 1)
|
||||
or (node_north.name == corner and node_north.param2 == 2))
|
||||
and ((node_east.name == roof and node_east.param2 == 0)
|
||||
or (node_east.name == corner and node_east.param2 == 0))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner, param2=1})
|
||||
end
|
||||
if ((node_east.name == roof and node_east.param2 == 2)
|
||||
or (node_east.name == corner and node_east.param2 == 3))
|
||||
and ((node_south.name == roof and node_south.param2 == 1)
|
||||
or (node_south.name == corner and node_south.param2 == 1))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner, param2=2})
|
||||
end
|
||||
|
||||
if ((node_east.name == roof and node_east.param2 == 2)
|
||||
or (node_east.name == corner and node_east.param2 == 3))
|
||||
and ((node_south.name == roof and node_south.param2 == 1)
|
||||
or (node_south.name == corner and node_south.param2 == 1))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner, param2=2})
|
||||
end
|
||||
if ((node_south.name == roof and node_south.param2 == 3)
|
||||
or (node_south.name == corner and node_south.param2 == 0))
|
||||
and ((node_west.name == roof and node_west.param2 == 2)
|
||||
or (node_west.name == corner and node_west.param2 == 2))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner, param2=3})
|
||||
end
|
||||
-- corner 2
|
||||
if ((node_west.name == roof and node_west.param2 == 2)
|
||||
or (node_west.name == corner_2 and node_west.param2 == 1))
|
||||
and ((node_north.name == roof and node_north.param2 == 1)
|
||||
or (node_north.name == corner_2 and node_north.param2 == 3))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner_2, param2=0})
|
||||
end
|
||||
|
||||
if ((node_south.name == roof and node_south.param2 == 3)
|
||||
or (node_south.name == corner and node_south.param2 == 0))
|
||||
and ((node_west.name == roof and node_west.param2 == 2)
|
||||
or (node_west.name == corner and node_west.param2 == 2))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner, param2=3})
|
||||
end
|
||||
-- corner 2
|
||||
if ((node_west.name == roof and node_west.param2 == 2)
|
||||
or (node_west.name == corner_2 and node_west.param2 == 1))
|
||||
and ((node_north.name == roof and node_north.param2 == 1)
|
||||
or (node_north.name == corner_2 and node_north.param2 == 3))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner_2, param2=0})
|
||||
end
|
||||
if ((node_north.name == roof and node_north.param2 == 3)
|
||||
or (node_north.name == corner_2 and node_north.param2 == 2))
|
||||
and ((node_east.name == roof and node_east.param2 == 2)
|
||||
or (node_east.name == corner_2 and node_east.param2 == 0))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner_2, param2=1})
|
||||
end
|
||||
|
||||
if ((node_north.name == roof and node_north.param2 == 3)
|
||||
or (node_north.name == corner_2 and node_north.param2 == 2))
|
||||
and ((node_east.name == roof and node_east.param2 == 2)
|
||||
or (node_east.name == corner_2 and node_east.param2 == 0))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner_2, param2=1})
|
||||
end
|
||||
if ((node_east.name == roof and node_east.param2 == 0)
|
||||
or (node_east.name == corner_2 and node_east.param2 == 3))
|
||||
and ((node_south.name == roof and node_south.param2 == 3)
|
||||
or (node_south.name == corner_2 and node_south.param2 == 1))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner_2, param2=2})
|
||||
end
|
||||
|
||||
if ((node_east.name == roof and node_east.param2 == 0)
|
||||
or (node_east.name == corner_2 and node_east.param2 == 3))
|
||||
and ((node_south.name == roof and node_south.param2 == 3)
|
||||
or (node_south.name == corner_2 and node_south.param2 == 1))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner_2, param2=2})
|
||||
end
|
||||
if ((node_south.name == roof and node_south.param2 == 1)
|
||||
or (node_south.name == corner_2 and node_south.param2 == 0))
|
||||
and ((node_west.name == roof and node_west.param2 == 0)
|
||||
or (node_west.name == corner_2 and node_west.param2 == 2))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner_2, param2=3})
|
||||
end
|
||||
|
||||
if ((node_south.name == roof and node_south.param2 == 1)
|
||||
or (node_south.name == corner_2 and node_south.param2 == 0))
|
||||
and ((node_west.name == roof and node_west.param2 == 0)
|
||||
or (node_west.name == corner_2 and node_west.param2 == 2))
|
||||
then
|
||||
minetest.swap_node(pos, {name=corner_2, param2=3})
|
||||
end
|
||||
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- MM: The following stuff is just for testing purposes for now; no generating of roots.
|
||||
-- I'm not satisfied with this; they should be either bigger or a different drawtype.
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- RooTS
|
||||
-----------------------------------------------------------------------------------------------
|
||||
if Roots == true then -- see settings.txt
|
||||
|
||||
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}
|
||||
|
@ -401,7 +396,6 @@ for i in pairs(TRuNKS) do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_alias("trunks:pine_trunkroot", "trunks:pine_treeroot")
|
||||
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
-- Settings for generation of stuff (at map-generation time)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Horizontal_Trunks = true
|
||||
|
||||
|
||||
|
||||
Trunks_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes
|
||||
|
||||
|
||||
Trunks_Rarity = 99 -- larger values make trunks more rare (100 means chance of 0 %)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Big_Twigs = true -- twigs larger than one node
|
||||
Twigs_on_ground = true
|
||||
|
||||
|
||||
|
||||
Twigs_on_ground_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes
|
||||
|
||||
Twigs_on_ground_Rarity = 66 -- larger values make twigs more rare (100 means chance of 0 %)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Twigs_on_water = true
|
||||
|
||||
|
||||
|
||||
Twigs_on_water_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes
|
||||
|
||||
|
||||
Twigs_on_water_Rarity = 33 -- larger values make twigs more rare (100 means chance of 0 %)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Moss_on_ground = true
|
||||
|
||||
|
||||
|
||||
Moss_on_ground_Max_Count = 400 -- absolute maximum number in an area of 80x80x80 nodes
|
||||
|
||||
Moss_on_ground_Rarity = 79 -- larger values makes moss more rare (100 means chance of 0 %)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Moss_on_trunk = true
|
||||
|
||||
|
||||
|
||||
Moss_on_trunk_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes
|
||||
|
||||
Moss_on_trunk_Rarity = 24 -- larger values makes moss more rare (100 means chance of 0 %)
|
||||
|
||||
|
||||
Auto_Roof_Corner = true -- behavior is similar (not the same!) to the one of minecraft stairs
|
||||
|
||||
|
||||
Roots = true
|
Loading…
Reference in New Issue