Moved lag command to szutilpack

This commit is contained in:
Aaron Suen 2022-12-09 17:58:36 -05:00
parent 9cbb733097
commit 9e45f873ae

View File

@ -303,23 +303,3 @@ register_cheat(
if not fov then return false, err end
player:set_properties({zoom_fov = fov})
end)
------------------------------------------------------------------------
-- SERVER LAG SIMULATOR
local lag = 0
register_cheat(
"lag",
"Set artificial lag for the server, in seconds per step",
"<seconds per step>",
function(_, param)
local num, err = numchk(param, 0, 1)
if err then return false, err end
lag = num
end)
local last = minetest.get_us_time()
minetest.register_globalstep(function()
local exp = last + lag * 1000000
while minetest.get_us_time() < exp do end
last = exp
end)