Private
Public Access
1
0

Update player kill tracking logic and increment version to 0.1.9

This commit is contained in:
Jan Grießhaber
2026-01-02 22:08:41 +01:00
parent b0705493ec
commit 1e736c89ab
3 changed files with 13 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
{
"Lua.workspace.userThirdParty": [
"c:\\Users\\jangr\\AppData\\Roaming\\Code\\User\\workspaceStorage\\ebd0abbb61655c51088fab51f622e068\\justarandomgeek.factoriomod-debug\\sumneko-3rd"
"c:\\Users\\jangr\\AppData\\Roaming\\Code\\User\\workspaceStorage\\340ead7f10d9ae8505ebc6dec42b1e88\\justarandomgeek.factoriomod-debug\\sumneko-3rd"
],
"Lua.workspace.checkThirdParty": "ApplyInMemory",
"factorio.versions": [

View File

@@ -134,20 +134,19 @@ end)
script.on_event(defines.events.on_player_died, function(event)
if event.cause and event.cause.player~=nil then
if event.cause and event.cause.type == "character" then
local killer = event.cause.player
if killer then
local killer_index = killer.index
local victim_index = event.player_index
log(("Player ID %d killed player ID %d"):format(killer_index,victim_index))
local killer = event.cause.player
if not killer then return end
local killer_index = killer.index
storage.playerKillCount[killer_index] =
storage.playerKillCount[killer_index] or {}
local victim_index = event.player_index
log(("Player ID %d killed player ID %d"):format(killer_index,victim_index))
storage.playerKillCount[killer_index] =
storage.playerKillCount[killer_index] or {}
storage.playerKillCount[killer_index][victim_index] =
(storage.playerKillCount[killer_index][victim_index] or 0) + 1
storage.playerKillCount[killer_index][victim_index] =
(storage.playerKillCount[killer_index][victim_index] or 0) + 1
end
end
storage.playerDeathCount[event.player_index] = (storage.playerDeathCount[event.player_index] or 0) + 1

View File

@@ -1,6 +1,6 @@
{
"name": "factorio-metrics-exporter",
"version": "0.1.8",
"version": "0.1.9",
"title": "Prometheus Metrics Exporter",
"author": "Jan Grießhaber",
"contact": "jan@griesshaber.systems",