Advertisement
Guest User

Untitled

a guest
May 3rd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. minetest.register_on_generated(function(minp, maxp, seed)
  2.  
  3.  
  4. local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
  5. local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
  6. local data = vm:get_data()
  7.  
  8. for z = minp.z, maxp.z do
  9. for y = minp.y, maxp.y do
  10. for x = minp.x, maxp.x do
  11. local vi = area:index(x, y, z)
  12. if data[vi] == minetest.get_content_id("air") and math.random(100) == 1 then
  13. data[vi] = minetest.get_content_id("default:bush_leaves")
  14. end
  15. end
  16. end
  17. end
  18.  
  19. vm:set_data(data)
  20. vm:set_lighting({day=0, night=0})
  21. vm:calc_lighting()
  22. vm:write_to_map(data)
  23.  
  24. for z = minp.z, maxp.z do
  25. for y = minp.y, maxp.y do
  26. for x = minp.x, maxp.x do
  27. local vi = area:index(x, y, z)
  28. if data[vi] == minetest.get_content_id("default:stone") and data[vi+area.ystride] == minetest.get_content_id("air") and math.random(5) == 1 then
  29. minetest.place_schematic_on_vmanip(vm, { x = x - 4, y = y, z = z - 4}, minetest.get_modpath("default").."/schematics/acacia_tree.mts", "random", nil, true)
  30. end
  31. end
  32. end
  33. end
  34.  
  35. end
  36. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement