nodecore-cd2025/mods/nc_api/util_gametime.lua
Aaron Suen 77bb713b77 Raise minimum log level to "action"
Log entries of "info" don't end up in server log
trace output by default; it's hard-coded to
LL_ACTION in main.cpp.
2020-07-05 08:14:52 -04:00

23 lines
671 B
Lua

-- LUALOCALS < ---------------------------------------------------------
local math, minetest, nodecore
= math, minetest, nodecore
local math_abs
= math.abs
-- LUALOCALS > ---------------------------------------------------------
nodecore.register_globalstep("gametime", function(dtime)
local mtt = minetest.get_gametime()
local nct = nodecore.gametime
if not nct then
nodecore.log("action", "nodecore.gametime: init to " .. mtt)
nct = mtt
end
nct = nct + dtime
if math_abs(nct - mtt) >= 2 then
nodecore.log("warning", "nodecore.gametime: excess drift; nct="
.. nct .. ", mtt=" .. mtt)
nct = mtt
end
nodecore.gametime = nct
end)