mirror of
https://github.com/minetest-mods/mesecons.git
synced 2025-07-07 18:10:25 +02:00
add timer and warning
This commit is contained in:
@ -63,6 +63,7 @@ minetest.register_globalstep(function (dtime)
|
|||||||
-- don't even try if server has not been running for XY seconds; resumetime = time to wait
|
-- don't even try if server has not been running for XY seconds; resumetime = time to wait
|
||||||
-- after starting the server before processing the ActionQueue, don't set this too low
|
-- after starting the server before processing the ActionQueue, don't set this too low
|
||||||
if (m_time < resumetime) then return end
|
if (m_time < resumetime) then return end
|
||||||
|
local t0 = minetest.get_us_time()
|
||||||
local actions = mesecon.tablecopy(mesecon.queue.actions)
|
local actions = mesecon.tablecopy(mesecon.queue.actions)
|
||||||
local actions_now={}
|
local actions_now={}
|
||||||
|
|
||||||
@ -84,6 +85,12 @@ minetest.register_globalstep(function (dtime)
|
|||||||
mesecon.queue:execute(actions_now[hp])
|
mesecon.queue:execute(actions_now[hp])
|
||||||
table.remove(actions_now, hp)
|
table.remove(actions_now, hp)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local t1 = minetest.get_us_time()
|
||||||
|
local diff = t1 - t0
|
||||||
|
if diff > 100000 then
|
||||||
|
minetest.log("warning", "[mesecons] globalstep took " .. diff .. " us")
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function mesecon.queue:execute(action)
|
function mesecon.queue:execute(action)
|
||||||
|
Reference in New Issue
Block a user