Guest User

Untitled

a guest
Jan 18th, 2013
46
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. generate_on_surfaces = function(
  2.         splant,
  3.         sradius,
  4.         ssurface,
  5.         savoid,
  6.         seed_diff,
  7.         lightmin,
  8.         lightmax,
  9.         nneighbors,
  10.         ocount,
  11.         facedir,
  12.         depthmax,
  13.         altmin,
  14.         altmax,
  15.         sbiome,
  16.         sbiomesize,
  17.         sbiomecount,
  18.         airsize,
  19.         aircount,
  20.         tempmin,
  21.         tempmax)
  22.     if seed_diff == nil then seed_diff = 0 end
  23.     if lightmin == nil then lightmin = 0 end
  24.     if lightmax == nil then lightmax = LIGHT_MAX end
  25.     if nneighbors == nil then nneighbors = ssurface end
  26.     if ocount == nil then ocount = -1 end
  27.     if depthmax == nil then depthmax = 1 end
  28.     if altmin == nil then altmin = -31000 end
  29.     if altmax == nil then altmax = 31000 end
  30.     if sbiome == nil then sbiome = "" end
  31.     if sbiomesize == nil then sbiomesize = 0 end
  32.     if sbiomecount == nil then sbiomecount = 1 end
  33.     if airsize == nil then airsize = 0 end
  34.     if aircount == nil then aircount = 1 end
  35.     if tempmin == nil then tempmin = -2 end
  36.     if tempmax == nil then tempmax = 2 end
  37.  
  38.     minetest.register_on_generated(
  39.  
  40.         local searchblocks = table.getn(minetest.env:find_nodes_in_area(minp, maxp, ssurface)
  41.         local surfaceblocks = {}
  42.         for s in ipairs(searchblocks) do
  43.             local pos = { x = searchblocks[s].x, y = searchblocks[s].y, z = searchblocks[s].z }
  44.             local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
  45.             if minetest.env:get_node(p_top) = "air" then table.insert(surfaceblocks, pos)
  46.         end
  47.  
  48.         while #surfaceblocks > 0 do
  49.             local r = math.random(1,#surfaceblocks)
  50.             local pos = surfaceblocks[r]
  51.             table.remove(surfaceblocks, r)
  52.            
  53.             local perlin1 = minetest.env:get_perlin(seed_diff, perlin_octaves, perlin_persistence, perlin_scale)
  54.             local perlin2 = minetest.env:get_perlin(temperature_seeddiff, temperature_octaves, temperature_persistence, temperature_scale)
  55.             local noise1 = perlin1:get2d({x=p_top.x, y=p_top.z})
  56.             local noise2 = perlin2:get2d({x=p_top.x, y=p_top.z})
  57.             [... etc. etc. etc. more code here ...]
  58.             [... rest of this routine is a duplicate of the initial spawn ABM ...]
  59.         end
  60.     )
  61. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×