Add player kill tracking and update version to 0.1.7
This commit is contained in:
@@ -149,11 +149,12 @@ end)
|
|||||||
|
|
||||||
function SendGameStats(event)
|
function SendGameStats(event)
|
||||||
local returnParts = {}
|
local returnParts = {}
|
||||||
returnParts[#returnParts+1] = GetMods()
|
GetMods()
|
||||||
returnParts[#returnParts+1] = GetMapSeed()
|
returnParts[#returnParts+1] = GetMapSeed()
|
||||||
returnParts[#returnParts+1] = GetRocketsLaunched()
|
returnParts[#returnParts+1] = GetRocketsLaunched()
|
||||||
returnParts[#returnParts+1] = GetPlayerTime()
|
returnParts[#returnParts+1] = GetPlayerTime()
|
||||||
returnParts[#returnParts+1] = GetPlayerDeaths()
|
returnParts[#returnParts+1] = GetPlayerDeaths()
|
||||||
|
returnParts[#returnParts+1] = GetPlayerKills()
|
||||||
helpers.send_udp(udpAddress, table.concat(returnParts, "\n"), serverIndex)
|
helpers.send_udp(udpAddress, table.concat(returnParts, "\n"), serverIndex)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,19 @@ function GetMods()
|
|||||||
helpers.send_udp(udpAddress, modstring,serverIndex)
|
helpers.send_udp(udpAddress, modstring,serverIndex)
|
||||||
end
|
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()
|
function GetMapSeed()
|
||||||
return("---map-seed---\n%d"):format(game.surfaces["nauvis"].map_gen_settings.seed)
|
return("---map-seed---\n%d"):format(game.surfaces["nauvis"].map_gen_settings.seed)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "factorio-metrics-exporter",
|
"name": "factorio-metrics-exporter",
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"title": "Prometheus Metrics Exporter",
|
"title": "Prometheus Metrics Exporter",
|
||||||
"author": "Jan Grießhaber",
|
"author": "Jan Grießhaber",
|
||||||
"contact": "jan@griesshaber.systems",
|
"contact": "jan@griesshaber.systems",
|
||||||
|
|||||||
Reference in New Issue
Block a user