Fixed send size of player entity stats
This commit is contained in:
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"Lua.workspace.userThirdParty": [
|
"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",
|
"Lua.workspace.checkThirdParty": "ApplyInMemory",
|
||||||
"factorio.versions": [
|
"factorio.versions": [
|
||||||
|
|||||||
@@ -240,7 +240,6 @@ function SendGameStats()
|
|||||||
returnParts[#returnParts + 1] = GetPlayerDeaths()
|
returnParts[#returnParts + 1] = GetPlayerDeaths()
|
||||||
returnParts[#returnParts + 1] = GetPlayerDeathCauses()
|
returnParts[#returnParts + 1] = GetPlayerDeathCauses()
|
||||||
returnParts[#returnParts + 1] = GetPlayerKills()
|
returnParts[#returnParts + 1] = GetPlayerKills()
|
||||||
returnParts[#returnParts + 1] = GetPlayerEntityStats()
|
|
||||||
helpers.send_udp(udpAddress, table.concat(returnParts, "\n"), serverIndex)
|
helpers.send_udp(udpAddress, table.concat(returnParts, "\n"), serverIndex)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -280,7 +279,10 @@ function SendAll(event)
|
|||||||
sendIndex = (sendIndex % 10) + 1
|
sendIndex = (sendIndex % 10) + 1
|
||||||
if sendIndex == 1 then SendProductionStats() end
|
if sendIndex == 1 then SendProductionStats() end
|
||||||
if sendIndex == 2 then SendPollutionStats() 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 == 4 then SendFluidProductionStats() end
|
||||||
if sendIndex == 5 then SendBuildStats() end
|
if sendIndex == 5 then SendBuildStats() end
|
||||||
if sendIndex == 6 then
|
if sendIndex == 6 then
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function GetPlayerKills()
|
|||||||
return table.concat(killParts, "\n")
|
return table.concat(killParts, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
function GetPlayerEntityStats()
|
function SendPlayerEntityStats()
|
||||||
local entityParts = {}
|
local entityParts = {}
|
||||||
entityParts[#entityParts + 1] = "---player-build-stats---"
|
entityParts[#entityParts + 1] = "---player-build-stats---"
|
||||||
for playerIndex, items in pairs(storage.constructedEntites) do
|
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)
|
entityParts[#entityParts + 1] = ("%s:%s:constructed:%s:%s"):format(playerIndex, playerName, itemName, itemCount)
|
||||||
end
|
end
|
||||||
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
|
for playerIndex, items in pairs(storage.deconstructedEntities) do
|
||||||
local playerName = game.players[playerIndex].name
|
local playerName = game.players[playerIndex].name
|
||||||
for itemName, itemCount in pairs(items) do
|
for itemName, itemCount in pairs(items) do
|
||||||
entityParts[#entityParts + 1] = ("%s:%s:deconstructed:%s:%s"):format(playerIndex, playerName, itemName, itemCount)
|
entityParts[#entityParts + 1] = ("%s:%s:deconstructed:%s:%s"):format(playerIndex, playerName, itemName, itemCount)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return table.concat(entityParts, "\n")
|
helpers.send_udp(udpAddress,table.concat(entityParts,"\n",serverIndex))
|
||||||
end
|
end
|
||||||
|
|
||||||
function GetMapSeed()
|
function GetMapSeed()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "factorio-metrics-exporter",
|
"name": "factorio-metrics-exporter",
|
||||||
"version": "0.3.2",
|
"version": "0.3.3",
|
||||||
"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