Private
Public Access
1
0

Rewritten sending helper and logic

This commit is contained in:
Jan Grießhaber
2026-01-10 18:24:52 +01:00
parent 8fc41c2e5a
commit 2e3ea7dd4d
14 changed files with 317 additions and 138 deletions

View File

@@ -5,7 +5,7 @@ function GetMods()
for k, v in pairs(mods) do
modstring = modstring .. ("%s:%s\n"):format(k, v)
end
helpers.send_udp(udpAddress, modstring, serverIndex)
SendChunked(modstring)
end
function GetPlayerColors()
@@ -33,24 +33,24 @@ function GetPlayerKills()
end
function SendPlayerEntityStats()
local entityParts = {}
entityParts[#entityParts + 1] = "---player-build-stats---"
for playerIndex, items in pairs(storage.constructedEntites) do
local playerName = game.players[playerIndex].name
for itemName, itemCount in pairs(items) do
entityParts[#entityParts + 1] = ("%s:%s:constructed:%s:%s"):format(playerIndex, playerName, itemName, itemCount)
local entityParts = {}
entityParts[#entityParts + 1] = "---player-build-stats---"
for playerIndex, items in pairs(storage.constructedEntites) do
local playerName = game.players[playerIndex].name
for itemName, itemCount in pairs(items) do
entityParts[#entityParts + 1] = ("%s:%s:constructed:%s:%s"):format(playerIndex, playerName, itemName, itemCount)
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
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)
SendChunked("---player-build-stats---\n" .. table.concat(entityParts,"\n"))
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
end
helpers.send_udp(udpAddress,table.concat(entityParts,"\n"),serverIndex)
SendChunked("---player-build-stats---\n" .. table.concat(entityParts,"\n"))
end
function GetMapSeed()
@@ -86,7 +86,7 @@ function GetPlayerDeaths()
end
function onPlayerDeath(event)
helpers.send_udp(udpAddress,("---player-died---\n%s:%s:%d"):format(event.player_index,game.players[event.player_index].name,event.tick),serverIndex)
SendChunked(("---player-died---\n%s:%s:%d"):format(event.player_index,game.players[event.player_index].name,event.tick))
end
function GetPlayerDeathCauses()