Rewritten sending helper and logic
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user