Guest User

Untitled

a guest
Jun 28th, 2013
218
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. minetest.register_on_generated(function(minp, maxp, seed)
  2.     local t1 = os.clock()
  3.  
  4.     local sidelen = maxp.x - minp.x + 1
  5.     local noise = minetest.get_perlin_map(
  6.         {offset=0, scale=1, spread={x=200, y=125, z=200}, seed=5, octaves=5, persist=0.6},
  7.         {x=sidelen, y=sidelen, z=sidelen}
  8.     )
  9.     local nvals = noise:get3dMap_flat({x=minp.x, y=minp.y, z=minp.z})
  10.  
  11.     local ni = 1
  12.     for z = minp.z, maxp.z do
  13.     for y = minp.y, maxp.y do
  14.     for x = minp.x, maxp.x do
  15.         local p = {x=x,y=y,z=z}
  16.         if nvals[ni] - (y - 25) / 55 > 0.5 then
  17.             if y < 1 then
  18.                 minetest.env:set_node(p, {name="default:dirt"})
  19.             else
  20.                 minetest.env:set_node(p, {name="default:dirt_with_grass"})
  21.             end
  22.         elseif y < 1 then
  23.             minetest.env:set_node(p, {name="default:water_source"})
  24.         end
  25.         ni = ni + 1
  26.     end
  27.     end
  28.     end
  29.  
  30.     print(string.format("elapsed time: %.2fms", (os.clock() - t1) * 1000))
  31. 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.

×