Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- generate_on_surfaces = function(
- splant,
- sradius,
- ssurface,
- savoid,
- seed_diff,
- lightmin,
- lightmax,
- nneighbors,
- ocount,
- facedir,
- depthmax,
- altmin,
- altmax,
- sbiome,
- sbiomesize,
- sbiomecount,
- airsize,
- aircount,
- tempmin,
- tempmax)
- if seed_diff == nil then seed_diff = 0 end
- if lightmin == nil then lightmin = 0 end
- if lightmax == nil then lightmax = LIGHT_MAX end
- if nneighbors == nil then nneighbors = ssurface end
- if ocount == nil then ocount = -1 end
- if depthmax == nil then depthmax = 1 end
- if altmin == nil then altmin = -31000 end
- if altmax == nil then altmax = 31000 end
- if sbiome == nil then sbiome = "" end
- if sbiomesize == nil then sbiomesize = 0 end
- if sbiomecount == nil then sbiomecount = 1 end
- if airsize == nil then airsize = 0 end
- if aircount == nil then aircount = 1 end
- if tempmin == nil then tempmin = -2 end
- if tempmax == nil then tempmax = 2 end
- minetest.register_on_generated(
- local searchblocks = table.getn(minetest.env:find_nodes_in_area(minp, maxp, ssurface)
- local surfaceblocks = {}
- for s in ipairs(searchblocks) do
- local pos = { x = searchblocks[s].x, y = searchblocks[s].y, z = searchblocks[s].z }
- local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
- if minetest.env:get_node(p_top) = "air" then table.insert(surfaceblocks, pos)
- end
- while #surfaceblocks > 0 do
- local r = math.random(1,#surfaceblocks)
- local pos = surfaceblocks[r]
- table.remove(surfaceblocks, r)
- local perlin1 = minetest.env:get_perlin(seed_diff, perlin_octaves, perlin_persistence, perlin_scale)
- local perlin2 = minetest.env:get_perlin(temperature_seeddiff, temperature_octaves, temperature_persistence, temperature_scale)
- local noise1 = perlin1:get2d({x=p_top.x, y=p_top.z})
- local noise2 = perlin2:get2d({x=p_top.x, y=p_top.z})
- [... etc. etc. etc. more code here ...]
- [... rest of this routine is a duplicate of the initial spawn ABM ...]
- end
- )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement