07850123d7
Use high-res version in a few places we were using integer-res timer before. This should e.g. smooth time variation of wind strength for ambient sounds.
23 lines
638 B
Lua
23 lines
638 B
Lua
-- LUALOCALS < ---------------------------------------------------------
|
|
local math, minetest, nodecore
|
|
= math, minetest, nodecore
|
|
local math_abs
|
|
= math.abs
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
minetest.register_globalstep(function(dtime)
|
|
local mtt = minetest.get_gametime()
|
|
local nct = nodecore.gametime
|
|
if not nct then
|
|
minetest.log("nodecore.gametime: init to " .. mtt)
|
|
nct = mtt
|
|
end
|
|
nct = nct + dtime
|
|
if math_abs(nct - mtt) >= 2 then
|
|
minetest.log("nodecore.gametime: excess drift; nct="
|
|
.. nct .. ", mtt=" .. mtt)
|
|
nct = mtt
|
|
end
|
|
nodecore.gametime = nct
|
|
end)
|