1
0
mirror of https://github.com/mt-mods/moretrees.git synced 2024-12-26 02:30:23 +01:00

Added support for spawning small fir trees in snow biomes. Made jungletrees

and palms require at least +15°C to grow.  This is supposed to keep them away
from snow biomes, but the engine doesn't let me tell the snow mod to always
run first.  Also please note that due to the load that snow biomes + moretrees
adds to the map generator, well... stuff will look cut off, broken, etc. due
to bugs in the map generator.
This commit is contained in:
Vanessa Ezekowitz 2013-02-23 12:34:01 -05:00
parent d21d4d2fb4
commit 6d74d09c9d
3 changed files with 72 additions and 59 deletions

View File

@ -18,7 +18,7 @@ moretrees.palm_biome = {
near_nodes = {"default:water_source"}, near_nodes = {"default:water_source"},
near_nodes_size = 15, near_nodes_size = 15,
near_nodes_count = 10, near_nodes_count = 10,
temp_min = 0.15, temp_min = 0.25,
temp_max = -0.15, temp_max = -0.15,
rarity = 50, rarity = 50,
max_count = 10, max_count = 10,
@ -76,30 +76,6 @@ moretrees.birch_biome = {
max_count = 10, max_count = 10,
} }
moretrees.spruce_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 335,
min_elevation = 20,
temp_min = 0.9,
temp_max = 0.7,
rarity = 50,
max_count = 5,
}
moretrees.pine_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 336,
near_nodes = {"default:water_source"},
near_nodes_size = 15,
near_nodes_count = 5,
rarity = 50,
max_count = 10,
}
moretrees.willow_biome = { moretrees.willow_biome = {
surface = "default:dirt_with_grass", surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes, avoid_nodes = moretrees.avoidnodes,
@ -136,6 +112,7 @@ moretrees.jungletree_biome = {
seed_diff = 329, seed_diff = 329,
min_elevation = -5, min_elevation = -5,
max_elevation = 10, max_elevation = 10,
temp_min = 0.25,
near_nodes = {"default:water_source"}, near_nodes = {"default:water_source"},
near_nodes_size = 20, near_nodes_size = 20,
near_nodes_count = 7, near_nodes_count = 7,
@ -143,6 +120,30 @@ moretrees.jungletree_biome = {
max_count = 10, max_count = 10,
} }
moretrees.spruce_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 335,
min_elevation = 20,
temp_min = 0.9,
temp_max = 0.7,
rarity = 50,
max_count = 5,
}
moretrees.pine_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 336,
near_nodes = {"default:water_source"},
near_nodes_size = 15,
near_nodes_count = 5,
rarity = 50,
max_count = 10,
}
moretrees.fir_biome = { moretrees.fir_biome = {
surface = "default:dirt_with_grass", surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes, avoid_nodes = moretrees.avoidnodes,
@ -154,3 +155,16 @@ moretrees.fir_biome = {
rarity = 50, rarity = 50,
max_count = 10, max_count = 10,
} }
moretrees.fir_biome_snow = {
surface = {"snow:dirt_with_snow", "snow:snow"},
below_nodes = {"default:dirt", "default:dirt_with_grass", "snow:dirt_with_snow"},
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 359,
rarity = 50,
max_count = 10,
check_air = false,
delete_above = true,
spawn_replace_node = true
}

View File

@ -45,6 +45,8 @@ plantslib:register_generate_plant(moretrees.spruce_biome, "moretrees:grow_spruce
plantslib:register_generate_plant(moretrees.jungletree_biome, "moretrees:grow_jungletree") plantslib:register_generate_plant(moretrees.jungletree_biome, "moretrees:grow_jungletree")
plantslib:register_generate_plant(moretrees.fir_biome, "moretrees:grow_fir") plantslib:register_generate_plant(moretrees.fir_biome, "moretrees:grow_fir")
plantslib:register_generate_plant(moretrees.fir_biome_snow, "moretrees:grow_fir_snow")
-- Code to spawn a birch tree -- Code to spawn a birch tree
function moretrees:grow_birch(pos) function moretrees:grow_birch(pos)
@ -121,7 +123,7 @@ function moretrees:grow_jungletree(pos)
minetest.env:spawn_tree(pos, moretrees.jungletree_model) minetest.env:spawn_tree(pos, moretrees.jungletree_model)
end end
-- code to spawn fir trees (formerly "conifers") -- code to spawn fir trees
function moretrees:grow_fir(pos) function moretrees:grow_fir(pos)
if math.random(2) == 1 then if math.random(2) == 1 then
@ -137,6 +139,9 @@ function moretrees:grow_fir(pos)
moretrees.fir_model.rules_b = moretrees.ct_rules_b2 moretrees.fir_model.rules_b = moretrees.ct_rules_b2
end end
moretrees.fir_model.iterations = 7
moretrees.fir_model.random_level = 5
minetest.env:remove_node(pos) minetest.env:remove_node(pos)
local leaves = minetest.env:find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves") local leaves = minetest.env:find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves")
for leaf in ipairs(leaves) do for leaf in ipairs(leaves) do
@ -145,38 +150,31 @@ function moretrees:grow_fir(pos)
minetest.env:spawn_tree(pos,moretrees.fir_model) minetest.env:spawn_tree(pos,moretrees.fir_model)
end end
-- Should we remove all the trees above the conifers altitude? -- same thing, but a smaller version that grows only in snow biomes
if moretrees.firs_remove_default_trees == true then function moretrees:grow_fir_snow(pos)
minetest.register_abm({ if math.random(2) == 1 then
nodenames = { moretrees.fir_model.leaves="moretrees:fir_leaves"
"default:tree", else
"default:leaves" moretrees.fir_model.leaves="moretrees:fir_leaves_bright"
}, end
interval = moretrees.firs_remove_interval, if math.random(2) == 1 then
chance = moretrees.firs_remove_chance, moretrees.fir_model.rules_a = moretrees.ct_rules_a1
moretrees.fir_model.rules_b = moretrees.ct_rules_b1
else
moretrees.fir_model.rules_a = moretrees.ct_rules_a2
moretrees.fir_model.rules_b = moretrees.ct_rules_b2
end
action = function(pos, node, _, _) moretrees.fir_model.iterations = 2
if minetest.env:get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" moretrees.fir_model.random_level = 2
and pos.y >= CONIFERS_ALTITUDE
then minetest.env:remove_node(pos)
minetest.env:add_node(pos , {name = "air"}) local leaves = minetest.env:find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves")
for leaf in ipairs(leaves) do
minetest.env:remove_node(leaves[leaf])
end end
end minetest.env:spawn_tree(pos,moretrees.fir_model)
})
end end
-- snow biomes mod uses this code to make biomes:
--
-- local perlin1 = env:get_perlin(112,3, 0.5, 150)
-- local test = perlin1:get2d({x=pos.x, y=pos.z})
-- if smooth and (test > 0.73 or (test > 0.43 and math.random(0,29) > (0.73 - test) * 100 )) then
-- in_biome = true
-- elseif not smooth and test > 0.53 then
-- in_biome = true
-- end
--
-- We'll just save this for possible later use ;-)
--
print("[Moretrees] Loaded (2013-02-11)") print("[Moretrees] Loaded (2013-02-11)")

View File

@ -2,9 +2,10 @@
Elevation Temperature Nearness to Nearby What nodes Perlin Avoid Elevation Temperature Nearness to Nearby What nodes Perlin Avoid
Tree type (m) (approx., °C) some node water to spawn on seed diff radius Tree type (m) (approx., °C) some node water to spawn on seed diff radius
----------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------
jungle tree - 5 to +10 n/a water, 20 10 dirt_with_grass 329 5 jungle tree - 5 to +10 above +15 water, 20 10 dirt_with_grass 329 5
fir above +25 -20 to +10 n/a n/a dirt_with_grass 359 8 fir above +25 -20 to +10 n/a n/a dirt_with_grass 359 8
palm - 1 to + 1 +18 to +32 water, 15 10 sand 330 5 firs on snow above +15 -20 to +10 n/a n/a snow:snow 359 8
palm - 1 to + 1 +15 to +32 water, 15 10 sand 330 5
apple + 1 to +10 +23 to +32 n/a n/a dirt_with grass 331 15 apple + 1 to +10 +23 to +32 n/a n/a dirt_with grass 331 15
oak 0 to +10 + 4 to +16 n/a n/a dirt_with grass 332 15 oak 0 to +10 + 4 to +16 n/a n/a dirt_with grass 332 15
sequoia 0 to +10 -30 to +50 n/a n/a dirt_with grass 333 10 sequoia 0 to +10 -30 to +50 n/a n/a dirt_with grass 333 10