forked from mtcontrib/plantlife_modpack
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@ -5,6 +5,11 @@ local random = math.random
|
||||
|
||||
abstract_youngtrees = {}
|
||||
|
||||
local youngtrees_youngtrees_rarity = tonumber(minetest.settings:get("youngtrees_youngtrees_rarity")) or 100
|
||||
local youngtrees_youngtrees_rarity_fertility = tonumber(minetest.settings:get("youngtrees_youngtrees_rarity_fertility")) or 0.5
|
||||
local youngtrees_youngtrees_fertility = tonumber(minetest.settings:get("youngtrees_youngtrees_fertility")) or -0.3
|
||||
|
||||
|
||||
minetest.register_node("youngtrees:bamboo", {
|
||||
description = S("Young Bamboo Tree"),
|
||||
drawtype="nodebox",
|
||||
@ -42,7 +47,7 @@ minetest.register_node("youngtrees:youngtree2_middle",{
|
||||
{-0.500000,0.125000,-0.500000,0.500000,0.500000,0.500000}, --NodeBox 3
|
||||
}
|
||||
},
|
||||
groups = {snappy=3,flammable=2,attached_node=1},
|
||||
groups = {snappy=3,flammable=2,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
drop = 'trunks:twig_1'
|
||||
})
|
||||
@ -65,7 +70,6 @@ minetest.register_node("youngtrees:youngtree_top", {
|
||||
drop = 'trunks:twig_1'
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("youngtrees:youngtree_middle", {
|
||||
description = S("Young Tree (middle)"),
|
||||
drawtype = "plantlike",
|
||||
@ -84,8 +88,6 @@ minetest.register_node("youngtrees:youngtree_middle", {
|
||||
drop = 'trunks:twig_1'
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_node("youngtrees:youngtree_bottom", {
|
||||
description = S("Young Tree (bottom)"),
|
||||
drawtype = "plantlike",
|
||||
@ -105,48 +107,47 @@ minetest.register_node("youngtrees:youngtree_bottom", {
|
||||
})
|
||||
|
||||
|
||||
abstract_youngtrees.grow_youngtree = function(pos)
|
||||
abstract_youngtrees.grow_youngtree = function(pos)
|
||||
abstract_youngtrees.grow_youngtree_node(pos, random(1,3))
|
||||
end
|
||||
|
||||
|
||||
abstract_youngtrees.grow_youngtree_node = function(pos, height)
|
||||
|
||||
|
||||
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local above_right_here = {x=pos.x, y=pos.y+2, z=pos.z}
|
||||
|
||||
if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
|
||||
if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
|
||||
or minetest.get_node(right_here).name == "default:junglegrass" then
|
||||
if height == 1 then
|
||||
minetest.swap_node(right_here, {name="youngtrees:youngtree_top"})
|
||||
minetest.swap_node(right_here, {name="youngtrees:youngtree_top"})
|
||||
end
|
||||
if height == 2 then
|
||||
minetest.swap_node(right_here, {name="youngtrees:youngtree_bottom"})
|
||||
minetest.swap_node(above_right_here, {name="youngtrees:youngtree_top"})
|
||||
minetest.swap_node(right_here, {name="youngtrees:youngtree_bottom"})
|
||||
minetest.swap_node(above_right_here, {name="youngtrees:youngtree_top"})
|
||||
end
|
||||
if height == 3 then
|
||||
local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z}
|
||||
minetest.swap_node(right_here, {name="youngtrees:youngtree_bottom"})
|
||||
minetest.swap_node(above_right_here, {name="youngtrees:youngtree_middle"})
|
||||
minetest.swap_node(two_above_right_here, {name="youngtrees:youngtree_top"})
|
||||
local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z}
|
||||
minetest.swap_node(right_here, {name="youngtrees:youngtree_bottom"})
|
||||
minetest.swap_node(above_right_here, {name="youngtrees:youngtree_middle"})
|
||||
minetest.swap_node(two_above_right_here, {name="youngtrees:youngtree_top"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
biome_lib.register_on_generate({
|
||||
surface = {
|
||||
"default:dirt_with_grass",
|
||||
"stoneage:grass_with_silex",
|
||||
"sumpf:peat",
|
||||
"sumpf:sumpf"
|
||||
surface = {
|
||||
"default:dirt_with_grass",
|
||||
"stoneage:grass_with_silex",
|
||||
"sumpf:peat",
|
||||
"sumpf:sumpf"
|
||||
},
|
||||
rarity = youngtrees_youngtrees_rarity,
|
||||
rarity_fertility = youngtrees_youngtrees_rarity_fertility,
|
||||
plantlife_limit = youngtrees_youngtrees_fertility,
|
||||
min_elevation = 1, -- above sea level
|
||||
},
|
||||
max_count = 55, --10,15
|
||||
rarity = 101 - 4, --3,4
|
||||
min_elevation = 1, -- above sea level
|
||||
plantlife_limit = -0.9,
|
||||
},
|
||||
abstract_youngtrees.grow_youngtree
|
||||
abstract_youngtrees.grow_youngtree
|
||||
)
|
||||
|
||||
minetest.log("action", "[youngtrees] loaded.")
|
||||
|
8
youngtrees/settingtypes.txt
Normal file
8
youngtrees/settingtypes.txt
Normal file
@ -0,0 +1,8 @@
|
||||
#Youngtree rarity %
|
||||
youngtrees_youngtrees_rarity (Youngtree rarity %) float 100 0 100
|
||||
|
||||
#How much the rarity is reduced by fertility %
|
||||
youngtrees_youngtrees_rarity_fertility (Youngtree rarity fertility reduction %) float 0.5 0 100
|
||||
|
||||
#Youngtree minimum fertility (-1 to +1)
|
||||
youngtrees_youngtrees_fertility (Youngtree minimum fertility) float -0.3 -1 1
|
Reference in New Issue
Block a user