diff --git a/control.lua b/control.lua index 3415316..e94ca6a 100644 --- a/control.lua +++ b/control.lua @@ -149,11 +149,12 @@ end) function SendGameStats(event) local returnParts = {} - returnParts[#returnParts+1] = GetMods() + GetMods() returnParts[#returnParts+1] = GetMapSeed() returnParts[#returnParts+1] = GetRocketsLaunched() returnParts[#returnParts+1] = GetPlayerTime() returnParts[#returnParts+1] = GetPlayerDeaths() + returnParts[#returnParts+1] = GetPlayerKills() helpers.send_udp(udpAddress, table.concat(returnParts, "\n"), serverIndex) end diff --git a/game-stats.lua b/game-stats.lua index ea740c1..b96a59b 100644 --- a/game-stats.lua +++ b/game-stats.lua @@ -8,6 +8,19 @@ function GetMods() helpers.send_udp(udpAddress, modstring,serverIndex) end +function GetPlayerKills() + local killParts = {} + killParts[#killParts+1] = "---player-kills---\n" + for killerIndex, victims in pairs(storage.playerKillCount) do + for victimIndex, kills in pairs(victims) do + local killerName = game.players(killerIndex) + local victimName = game.players(victimIndex) + killParts[#killParts+1] = ("%s:%s:%s:%s:%d"):format(killerIndex,killerName,victimIndex,victimName,kills) + end + end + return table.concat(killParts,"\n") +end + function GetMapSeed() return("---map-seed---\n%d"):format(game.surfaces["nauvis"].map_gen_settings.seed) end diff --git a/info.json b/info.json index f25c1c5..9b9d622 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "factorio-metrics-exporter", - "version": "0.1.6", + "version": "0.1.7", "title": "Prometheus Metrics Exporter", "author": "Jan Grießhaber", "contact": "jan@griesshaber.systems",