Fixed waterlilies to only grow in water about 3 nodes deep or less. Decreased

guard radius around them to allow them to get a bit more dense.  Decreased the
perlin limit slightly, makes the biomes a little bigger.
This commit is contained in:
Vanessa Ezekowitz 2012-12-02 19:22:33 -05:00
parent 46ae097460
commit eb26c9d966
3 changed files with 21 additions and 14 deletions

View File

@ -66,6 +66,8 @@ ocount: There must be at least this many of the above neighbors around the
0. 0.
facedir: The value passed to the param2 variable when adding the plant node facedir: The value passed to the param2 variable when adding the plant node
to the map. Defaults to 0. to the map. Defaults to 0.
depthmax: If a node spawns on top of a water source, the water must be at
most this deep. Defaults to 1 node.
----- -----
The second function, grow_plants() is defined like so: The second function, grow_plants() is defined like so:

View File

@ -18,7 +18,7 @@ local enable_flowers = true
local enable_junglegrass = true local enable_junglegrass = true
local enable_poisonivy = true local enable_poisonivy = true
local plantlife_debug = false local plantlife_debug = true
local plantlife_seed_diff = 123 local plantlife_seed_diff = 123
local perlin_octaves = 3 local perlin_octaves = 3
@ -90,13 +90,13 @@ end
-- The spawning ABM -- The spawning ABM
spawn_on_surfaces = function(sdelay, splant, sradius, schance, ssurface, savoid, seed_diff, lightmin, lightmax, nneighbors, ocount, facedir) spawn_on_surfaces = function(sdelay, splant, sradius, schance, ssurface, savoid, seed_diff, lightmin, lightmax, nneighbors, ocount, facedir, depthmax)
if seed_diff == nil then seed_diff = 0 end if seed_diff == nil then seed_diff = 0 end
if lightmin == nil then lightmin = 0 end if lightmin == nil then lightmin = 0 end
if lightmax == nil then lightmax = LIGHT_MAX end if lightmax == nil then lightmax = LIGHT_MAX end
if nneighbors == nil then nneighbors = ssurface end if nneighbors == nil then nneighbors = ssurface end
if ocount == nil then ocount = 0 end if ocount == nil then ocount = 0 end
dbg(sdelay.." "..splant.." "..sradius.." "..schance.." "..ssurface.." "..dump(savoid).." "..lightmin.." "..lightmax.." "..dump(nneighbors).." "..ocount) if depthmax == nil then depthmax = 1 end
minetest.register_abm({ minetest.register_abm({
nodenames = { ssurface }, nodenames = { ssurface },
interval = sdelay, interval = sdelay,
@ -119,12 +119,17 @@ spawn_on_surfaces = function(sdelay, splant, sradius, schance, ssurface, savoid,
dbg("Spawn: poisonivy:climbing at "..dump(p_top).." on "..ssurface) dbg("Spawn: poisonivy:climbing at "..dump(p_top).." on "..ssurface)
minetest.env:add_node(p_top, { name = "poisonivy:climbing", param2 = walldir }) minetest.env:add_node(p_top, { name = "poisonivy:climbing", param2 = walldir })
else else
local deepnode = minetest.env:get_node({ x = pos.x, y = pos.y-depthmax-1, z = pos.z }).name
if (ssurface ~= "default:water_source")
or (ssurface == "default:water_source"
and deepnode ~= "default:water_source") then
dbg("Spawn: "..splant.." at "..dump(p_top).." on "..ssurface) dbg("Spawn: "..splant.." at "..dump(p_top).." on "..ssurface)
minetest.env:add_node(p_top, { name = splant, param2 = facedir }) minetest.env:add_node(p_top, { name = splant, param2 = facedir })
end end
end end
end end
end end
end
}) })
end end
@ -289,7 +294,7 @@ if enable_flowers then
}, },
}) })
spawn_on_surfaces(spawn_delay/2, "flowers:flower_waterlily", 10 , spawn_chance*3, "default:water_source" , {"group:flower"}, flowers_seed_diff, 10, nil, {"default:dirt_with_grass"}, nil, nil,10) spawn_on_surfaces(spawn_delay/2, "flowers:flower_waterlily", 3, spawn_chance*2, "default:water_source" , {"group:flower"}, flowers_seed_diff, 10, nil, nil, nil, nil, 4)
spawn_on_surfaces(spawn_delay*2, "flowers:flower_seaweed" , 0.1, spawn_chance*2, "default:water_source" , {"group:flower"}, flowers_seed_diff, 4, 10, {"default:dirt_with_grass"}, 0, 1) spawn_on_surfaces(spawn_delay*2, "flowers:flower_seaweed" , 0.1, spawn_chance*2, "default:water_source" , {"group:flower"}, flowers_seed_diff, 4, 10, {"default:dirt_with_grass"}, 0, 1)
spawn_on_surfaces(spawn_delay*2, "flowers:flower_seaweed" , 0.1, spawn_chance*2, "default:dirt_with_grass", {"group:flower"}, flowers_seed_diff, 4, 10, {"default:water_source"} , 1, 1) spawn_on_surfaces(spawn_delay*2, "flowers:flower_seaweed" , 0.1, spawn_chance*2, "default:dirt_with_grass", {"group:flower"}, flowers_seed_diff, 4, 10, {"default:water_source"} , 1, 1)

View File

@ -25,7 +25,7 @@ local perlin_octaves = 3
local perlin_persistence = 0.2 local perlin_persistence = 0.2
local perlin_scale = 25 local perlin_scale = 25
local plantlife_limit = 0.6 -- compared against perlin noise. lower = more abundant local plantlife_limit = 0.5 -- compared against perlin noise. lower = more abundant
local spawn_delay = 2000 -- 2000 local spawn_delay = 2000 -- 2000
local spawn_chance = 100 -- 100 local spawn_chance = 100 -- 100
@ -384,10 +384,10 @@ if enable_junglegrass then
}, },
}) })
spawn_on_surfaces(spawn_delay*2, "junglegrass:shortest", 4, spawn_chance/50, "default:dirt_with_grass", {"group:junglegrass", "default:junglegrass", "default:dry_shrub"}, junglegrass_seed_diff, 5) spawn_on_surfaces(spawn_delay*2, "junglegrass:shortest", 4, spawn_chance, "default:dirt_with_grass", {"group:junglegrass", "default:junglegrass", "default:dry_shrub"}, junglegrass_seed_diff, 5)
spawn_on_surfaces(spawn_delay*2, "junglegrass:shortest", 4, spawn_chance/50, "default:sand" , {"group:junglegrass", "default:junglegrass", "default:dry_shrub"}, junglegrass_seed_diff, 5) spawn_on_surfaces(spawn_delay*2, "junglegrass:shortest", 4, spawn_chance*2, "default:sand" , {"group:junglegrass", "default:junglegrass", "default:dry_shrub"}, junglegrass_seed_diff, 5)
spawn_on_surfaces(spawn_delay*2, "junglegrass:shortest", 4, spawn_chance/10, "default:desert_sand" , {"group:junglegrass", "default:junglegrass", "default:dry_shrub"}, junglegrass_seed_diff, 5) spawn_on_surfaces(spawn_delay*2, "junglegrass:shortest", 4, spawn_chance*3, "default:desert_sand" , {"group:junglegrass", "default:junglegrass", "default:dry_shrub"}, junglegrass_seed_diff, 5)
spawn_on_surfaces(spawn_delay*2, "junglegrass:shortest", 4, spawn_chance/10, "default:desert_sand" , {"group:junglegrass", "default:junglegrass", "default:dry_shrub"}, junglegrass_seed_diff, 5) spawn_on_surfaces(spawn_delay*2, "junglegrass:shortest", 4, spawn_chance*3, "default:desert_sand" , {"group:junglegrass", "default:junglegrass", "default:dry_shrub"}, junglegrass_seed_diff, 5)
for i in ipairs(grasses_list) do for i in ipairs(grasses_list) do
grow_plants(grow_delay, grow_chance/2, grasses_list[i][1], grasses_list[i][2], "default:desert_sand", {"default:dirt_with_grass", "default:sand", "default:desert_sand"}) grow_plants(grow_delay, grow_chance/2, grasses_list[i][1], grasses_list[i][2], "default:desert_sand", {"default:dirt_with_grass", "default:sand", "default:desert_sand"})