diff --git a/rocks/gensed.lua b/rocks/gensed.lua index 72c3954..9dd67dd 100644 --- a/rocks/gensed.lua +++ b/rocks/gensed.lua @@ -34,10 +34,8 @@ local np_sp = { local stats stats={ total=0 } -rocksl.gensed = function (minp, maxp, seed) +rocksl.gensed = function (minp, maxp, seed, vm, area) local t1 = os.clock() - local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") - local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax} local data = vm:get_data() local chunksize = maxp.x - minp.x + 1 @@ -160,7 +158,6 @@ rocksl.gensed = function (minp, maxp, seed) end end if generated then vm:set_data(data) - vm:write_to_map(data) if stats then for k,v in pairs(stats) do print("stat: "..k..": "..((v/stats.total)*100).."%") end end else print("no sed layer y="..minp.y) diff --git a/rocks/ign.lua b/rocks/ign.lua index 4e6ef69..fe7ed41 100644 --- a/rocks/ign.lua +++ b/rocks/ign.lua @@ -91,10 +91,9 @@ local np_intr = { seed = 3740, } -minetest.register_on_generated( function( minp, maxp, seed ) +--minetest.register_on_generated( function( minp, maxp, seed ) +rocksl.genign=function(minp,maxp,seed, vm, area) local t1 = os.clock() - local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") - local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax} local data = vm:get_data() local chunksize = maxp.x - minp.x + 1 @@ -137,9 +136,8 @@ minetest.register_on_generated( function( minp, maxp, seed ) vm:set_data(data) --DEBUG: vm:set_lighting({day=15,night=2}) minetest.generate_ores(vm) - vm:write_to_map(data) minetest.log("action", "rocks/layer/ "..math.ceil((os.clock() - t1) * 1000).." ms ") -end) +end -- ~ Tomas Brod \ No newline at end of file diff --git a/rocks/init.lua b/rocks/init.lua index 1d8df9c..70795cb 100644 --- a/rocks/init.lua +++ b/rocks/init.lua @@ -30,7 +30,14 @@ dofile(modpath.."/ign.lua") dofile(modpath.."/skarn.lua") dofile(modpath.."/pegmatite.lua") dofile(modpath.."/gensed.lua") -minetest.register_on_generated(rocksl.gensed) + +minetest.register_on_generated(function(minp,maxp,seed) + local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") + local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax} + rocksl.gensed(minp,maxp,seed,vm,area) + --rocksl.genign + vm:write_to_map(data) +end) minetest.register_on_mapgen_init(function(mapgen_params) -- todo: disable caves and ores