Add timer checkpoints

pull/2/head
Bram van den Heuvel 2024-04-30 17:37:34 +02:00 committed by Bram
parent 3c38b5844a
commit c1aa5b16d6
1 changed files with 13 additions and 1 deletions

View File

@ -693,6 +693,8 @@ function internal.generate_caves(data, minp, maxp)
-- Get cave bools
local bools = internal.flat_from_cave_bools(bminp, bmaxp)
timer.checkpoint("Calculate cave shape")
-- Get node types
local nts = internal.flat_from_node_types(bools, bminp, bmaxp)
@ -704,6 +706,8 @@ function internal.generate_caves(data, minp, maxp)
internal.humidity_noise_params(), bminp, bmaxp
)
timer.checkpoint("Calculate block types & biomes")
local air = minetest.get_content_id("air")
local schems = {}
@ -1176,10 +1180,15 @@ end
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
minetest.register_on_generated(function(minp, maxp, blockseed)
timer.start()
math.randomseed(blockseed)
local vm = minetest.get_mapgen_object("voxelmanip")
local flat, schems = internal.generate_caves(vm:get_data(), minp, maxp)
local data = vm:get_data()
local flat, schems = internal.generate_caves(data, minp, maxp)
timer.checkpoint("Place caves")
internal.place_simple_decorations(flat, schems)
@ -1187,6 +1196,9 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
vm:write_to_map()
internal.place_schematic_decorations(vm, schems)
timer.checkpoint("Place decorations")
timer.stop()
end)
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------