Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- "Record" the chunks being generated by the core mapgen
- minetest.register_on_generated(function(minp, maxp, blockseed)
- biome_lib.blocklist_aircheck[#biome_lib.blocklist_aircheck + 1] = { minp, maxp }
- end)
- minetest.register_on_generated(function(minp, maxp, blockseed)
- biome_lib.blocklist_no_aircheck[#biome_lib.blocklist_no_aircheck + 1] = { minp, maxp }
- end)
- -- "Play" them back, populating them with new stuff in the process
- minetest.register_globalstep(function(dtime)
- if dtime < 0.2 and -- don't attempt to populate if lag is already too high
- (#biome_lib.blocklist_aircheck > 0 or #biome_lib.blocklist_no_aircheck > 0) then
- biome_lib.globalstep_start_time = minetest.get_us_time()
- biome_lib.globalstep_runtime = 0
- while (#biome_lib.blocklist_aircheck > 0 or #biome_lib.blocklist_no_aircheck > 0)
- and biome_lib.globalstep_runtime < 200000 do -- 0.2 seconds, in uS.
- if #biome_lib.blocklist_aircheck > 0 then
- biome_lib:generate_block_with_air_checking()
- end
- if #biome_lib.blocklist_no_aircheck > 0 then
- biome_lib:generate_block_no_aircheck()
- end
- biome_lib.globalstep_runtime = minetest.get_us_time() - biome_lib.globalstep_start_time
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement