Last active
March 9, 2022 00:44
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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