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

@@ -56,28 +56,6 @@ function GetEstimatedResearchTime()
return returnSpeed..returnTime..returnNameID..returnProgress..returnCost
end
function UpdateLabInfos()
local totalLabs = 0
local totalSpeed = 0
totalLabs = #storage.labs
for _, lab in pairs(storage.labs) do
if lab.valid then
if lab.status == defines.entity_status.working then
local labBase
if lab.name == "biolab" then
labBase = biolabBaseSpeed
else
labBase = labBaseSpeed
end
local labSpeed = (labBase + (labBase * game.forces["player"].laboratory_speed_modifier)) * (lab.effects.speed or 1)
totalSpeed = totalSpeed + (labSpeed* (1+(lab.effects.productivity or 0)))
end
end
end
storage.totalLabCount = totalLabs
storage.totalResearchSpeed = totalSpeed
end
function GetCurrentResearchSpeed()
local totalResearch = 0
local playerForce = game.forces["player"]
@@ -92,7 +70,7 @@ function SendResearchStats()
if options.enableResearch == true then
local researchTimeInfo = GetEstimatedResearchTime()
if researchTimeInfo then
helpers.send_udp(udpAddress, researchTimeInfo, serverIndex)
SendChunked(researchTimeInfo)
end
end
end