Fix `[sheet` usage in particle spawner.
[insidethebox.git] / mods / status / init.lua
blobf0495dde79f898a0e4b19dc3e523e53f4eb59190
2 --[[
4 ITB (insidethebox) minetest game - Copyright (C) 2017-2018 sofar & nore
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public License
8 as published by the Free Software Foundation; either version 2.1
9 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19 MA 02111-1307 USA
21 ]]--
24 -- print server status (version, uptime, max_lag, clients) every 5 minutes
27 local function print_status()
28 local clients = function()
29 local s = ""
30 for _, v in pairs(minetest.get_connected_players()) do
31 if s ~= "" then s = s .. " " end
32 s = s .. v:get_player_name()
33 end
34 return s
35 end
36 local clientcount = function()
37 local c = 0
38 for _, _ in pairs(minetest.get_connected_players()) do
39 c = c + 1
40 end
41 return c
42 end
44 minetest.log("action",
45 "|minetest server status report|" ..
46 "version=\"" .. minetest.get_version().string .. "\", " ..
47 "uptime=\"" .. math.floor(minetest.get_server_uptime() / 86400) .. "\", " ..
48 "max_lag=\"" .. math.floor(minetest.get_server_max_lag() * 1000)/1000 .. "\", " ..
49 "client_count=\"" .. clientcount() .. "\", " ..
50 "clients=\"" .. clients() .. "\""
53 minetest.after(300, print_status)
54 end
55 minetest.after(10, print_status)