Skip to content

Instantly share code, notes, and snippets.

@appgurueu
Last active March 9, 2022 00:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save appgurueu/2adcc3bf4e3d7f8a22f2454410e0ca80 to your computer and use it in GitHub Desktop.
Save appgurueu/2adcc3bf4e3d7f8a22f2454410e0ca80 to your computer and use it in GitHub Desktop.
Shuts down the server if it lags too much ("antilag" Minetest mod init.lua)
local min_lag = 1 -- in seconds
local min_times = 10 -- has to occur 10x
local times = 0
minetest.register_globalstep(function(lag)
if lag < min_lag then
times = 0
else
times = times + 1
if times >= min_times then
minetest.request_shutdown("Server shutting down due to high latency (lag).")
end
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment