Private
Public Access
1
0

Fixed send size of player entity stats

This commit is contained in:
Jan Grießhaber
2026-01-06 16:20:45 +01:00
parent a6e503da3d
commit cb2e6fec50
4 changed files with 11 additions and 6 deletions

View File

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

View File

@@ -240,7 +240,6 @@ function SendGameStats()
returnParts[#returnParts + 1] = GetPlayerDeaths()
returnParts[#returnParts + 1] = GetPlayerDeathCauses()
returnParts[#returnParts + 1] = GetPlayerKills()
returnParts[#returnParts + 1] = GetPlayerEntityStats()
helpers.send_udp(udpAddress, table.concat(returnParts, "\n"), serverIndex)
end
end
@@ -280,7 +279,10 @@ function SendAll(event)
sendIndex = (sendIndex % 10) + 1
if sendIndex == 1 then SendProductionStats() end
if sendIndex == 2 then SendPollutionStats() end
if sendIndex == 3 then SendKillStats() end
if sendIndex == 3 then
SendKillStats()
SendPlayerEntityStats()
end
if sendIndex == 4 then SendFluidProductionStats() end
if sendIndex == 5 then SendBuildStats() end
if sendIndex == 6 then

View File

@@ -32,7 +32,7 @@ function GetPlayerKills()
return table.concat(killParts, "\n")
end
function GetPlayerEntityStats()
function SendPlayerEntityStats()
local entityParts = {}
entityParts[#entityParts + 1] = "---player-build-stats---"
for playerIndex, items in pairs(storage.constructedEntites) do
@@ -41,13 +41,16 @@ function GetPlayerEntityStats()
entityParts[#entityParts + 1] = ("%s:%s:constructed:%s:%s"):format(playerIndex, playerName, itemName, itemCount)
end
end
helpers.send_udp(udpAddress,table.concat(entityParts,"\n",serverIndex))
entityParts = {}
entityParts[#entityParts + 1] = "---player-build-stats---"
for playerIndex, items in pairs(storage.deconstructedEntities) do
local playerName = game.players[playerIndex].name
for itemName, itemCount in pairs(items) do
entityParts[#entityParts + 1] = ("%s:%s:deconstructed:%s:%s"):format(playerIndex, playerName, itemName, itemCount)
end
end
return table.concat(entityParts, "\n")
helpers.send_udp(udpAddress,table.concat(entityParts,"\n",serverIndex))
end
function GetMapSeed()

View File

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