Private
Public Access
1
0

Initial Commit

This commit is contained in:
Jan Grießhaber
2025-12-28 18:48:24 +01:00
commit 149b085cb7
13 changed files with 296 additions and 0 deletions

22
game-stats.lua Normal file
View File

@@ -0,0 +1,22 @@
---Sends all mod infos for the current game, should only be called on the first load of the map since mods don't change during runtime
function GetMods()
local mods = script.active_mods
local modstring = "---mod-info---\n"
for k,v in pairs(mods) do
modstring = modstring .. ("mod-info:%s:%s\n"):format(k,v)
end
helpers.send_udp(52555, modstring,1)
end
---Concats all player online times into a single string
---Takes all players that ever visited the server into account
---@return string
function GetPlayerTime()
local timeParts = {}
timeParts[#timeParts+1] = "---player-times---\n"
for _,player in pairs(game.players) do
timeParts[#timeParts+1] = ("player-time:%s:%d:%d"):format(player.name, player.index, player.online_time)
end
return table.concat(timeParts, "\n")
end