nodecore-cd2025/mods/nc_api/util_gametime.lua
Aaron Suen 8bfdc211a3 Convert some action logs to info
We were using action log level for a lot of
things because by default MT does not seem
to capture info logs to stderr.  On "production"
servers though this makes too much noise and
makes it hard to find actual player actions.
Servers that want info logging will just have
to configure/compile it in.
2021-12-11 21:26:18 -05:00

23 lines
669 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("info", "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)