-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check if server_announce was enabled before changing it
- Loading branch information
BuckarooBanzay
authored and
BuckarooBanzay
committed
Jan 6, 2020
1 parent
e6ef5aa
commit 932cc69
Showing
1 changed file
with
16 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |