check if server_announce was enabled before changing it
parent
e6ef5aa8b7
commit
932cc69304
27
init.lua
27
init.lua
|
@ -1,15 +1,20 @@
|
|||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
timer = timer + dtime
|
||||
if timer < 15 then
|
||||
return
|
||||
end
|
||||
if minetest.settings:get_bool("server_announce", false) then
|
||||
-- only change announce setting if it was enabled in the first place
|
||||
|
||||
timer = 0
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
timer = timer + dtime
|
||||
if timer < 15 then
|
||||
return
|
||||
end
|
||||
|
||||
local threshold = tonumber(minetest.settings:get("server_cloak.threshold") or "15")
|
||||
local player_count = #minetest.get_connected_players()
|
||||
timer = 0
|
||||
|
||||
minetest.settings:set_bool("server_announce", player_count < threshold)
|
||||
end)
|
||||
local threshold = tonumber(minetest.settings:get("server_cloak.threshold") or "15")
|
||||
local player_count = #minetest.get_connected_players()
|
||||
|
||||
minetest.settings:set_bool("server_announce", player_count < threshold)
|
||||
end)
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue