mirror of
https://github.com/mt-mods/moretrees.git
synced 2024-11-05 09:50:34 +01:00
Transition trees to only spawn at mapgen time instead of using abms
(growing from saplings still uses an abm, however).
This commit is contained in:
parent
59a6323ceb
commit
103d75886e
72
init.lua
72
init.lua
|
@ -62,40 +62,44 @@ local conifers_seed_diff = plantslib.plantlife_seed_diff + 30
|
||||||
|
|
||||||
-- Spawning functions
|
-- Spawning functions
|
||||||
|
|
||||||
-- generate_on_surfaces = function(splant, sradius, ssurface, savoid,
|
jungletrees_biome = {
|
||||||
-- seed_diff, lightmin, lightmax, nneighbors, ocount, facedir,
|
surface = "default:dirt_with_grass", -- must grow on grass only
|
||||||
-- depthmax, altitudemin, altitudemax,sbiome,sbiomesize,
|
avoid = {"jungletree:sapling","default:jungletree"}, -- avoid spawning near these
|
||||||
-- sbiomecount,tempmin,tempmax)
|
radius = JT_RADIUS, -- Keep this much room around the above avoid items
|
||||||
|
seed_diff = jungletree_seed_diff, -- duh? :-)
|
||||||
|
neighbors = nil, -- we don't care about neighbors
|
||||||
|
ncount = nil, -- or the count thereof
|
||||||
|
water_depth = nil, -- or water depth
|
||||||
|
min_elevation = -5, -- must be 5m below sea level or higher
|
||||||
|
max_elevation = 10, -- but no higher than 10m
|
||||||
|
near_nodes = {"default:water_source"}, -- Jungle trees must be near water
|
||||||
|
near_nodes_size = JT_WATER_RADIUS, -- within this radius of it (default 25)
|
||||||
|
near_nodes_count = JT_WATER_COUNT, -- with this many water nodes in the area
|
||||||
|
temp_min = nil, -- don't care about temperature
|
||||||
|
temp_max = nil, -- at either end of the scale
|
||||||
|
exec_funct = "moretrees:grow_jungletree" -- name of the function to execute to grow a tree
|
||||||
|
}
|
||||||
|
|
||||||
plantslib:generate_on_surfaces(
|
conifers_biome = {
|
||||||
"jungletree:sapling", -- We want to spawn a sapling
|
surface = "default:dirt_with_grass",
|
||||||
JT_RADIUS, -- Keep this much room around saplings
|
avoid = {"conifers:sapling", "conifers:trunk"},
|
||||||
"default:dirt_with_grass", -- must grow on grass only
|
radius = CONIFERS_DISTANCE,
|
||||||
{"jungletree:sapling","default:jungletree"}, -- avoid spawning near these
|
seed_diff = conifers_seed_diff,
|
||||||
jungletree_seed_diff, -- duh? :-)
|
neighbors = nil,
|
||||||
{"default:dirt_with_grass"}, -- must have grass..
|
ncount = nil,
|
||||||
8, -- in all 8 of the surrounding nodes
|
water_depth = nil,
|
||||||
nil, -- we don't care about facedir
|
min_elevation = CONIFERS_ALTITUDE,
|
||||||
nil, -- or water depth
|
max_elevation = nil,
|
||||||
-5, -- must be 5m below sea level or higher
|
near_nodes = nil,
|
||||||
10, -- but no higher than 10m
|
near_nodes_size = nil,
|
||||||
{"default:water_source"}, -- Jungle trees must be near water
|
near_nodes_count = nil,
|
||||||
JT_WATER_RADIUS, -- within this radius of it (default 25)
|
temp_min = nil,
|
||||||
JT_WATER_COUNT -- with this many water nodes in the area
|
temp_max = nil,
|
||||||
)
|
exec_funct = "moretrees:grow_conifer"
|
||||||
|
}
|
||||||
|
|
||||||
plantslib:generate_on_surfaces(
|
plantslib:register_generate_plant(jungletrees_biome)
|
||||||
"conifers:sapling",
|
plantslib:register_generate_plant(conifers_biome)
|
||||||
CONIFERS_DISTANCE,
|
|
||||||
"default:dirt_with_grass",
|
|
||||||
{"conifers:sapling", "conifers:trunk"},
|
|
||||||
conifers_seed_diff,
|
|
||||||
{"default:dirt_with_grass"},
|
|
||||||
8,
|
|
||||||
nil,
|
|
||||||
nil,
|
|
||||||
CONIFERS_ALTITUDE
|
|
||||||
)
|
|
||||||
|
|
||||||
-- growing functions
|
-- growing functions
|
||||||
|
|
||||||
|
@ -178,7 +182,7 @@ local ct_rules_b2 = "[-fB][+fB]"
|
||||||
|
|
||||||
-- Code that actually spawns the trees!
|
-- Code that actually spawns the trees!
|
||||||
|
|
||||||
function moretrees:grow_jungletree(pos, noise)
|
function moretrees:grow_jungletree(pos)
|
||||||
local r1 = math.random(2)
|
local r1 = math.random(2)
|
||||||
local r2 = math.random(3)
|
local r2 = math.random(3)
|
||||||
if r1 == 1 then
|
if r1 == 1 then
|
||||||
|
@ -216,7 +220,7 @@ function moretrees:grow_jungletree(pos, noise)
|
||||||
minetest.env:spawn_tree(pos,jungle_tree)
|
minetest.env:spawn_tree(pos,jungle_tree)
|
||||||
end
|
end
|
||||||
|
|
||||||
function moretrees:grow_conifer(pos, noise)
|
function moretrees:grow_conifer(pos)
|
||||||
if math.random(2) == 1 then
|
if math.random(2) == 1 then
|
||||||
conifer_tree["leaves"]="conifers:leaves"
|
conifer_tree["leaves"]="conifers:leaves"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user