Fixed options
This commit is contained in:
@@ -2,6 +2,21 @@ storage.totalLabCount = 0
|
||||
local labBaseSpeed = 1
|
||||
local biolabBaseSpeed = 2
|
||||
|
||||
LabsScanned = false
|
||||
|
||||
|
||||
function GenerateLabInfo()
|
||||
for _, surface in pairs(game.surfaces) do
|
||||
local labs = surface.find_entities_filtered({type="lab"})
|
||||
for index, lab in pairs(labs) do
|
||||
if lab.valid then
|
||||
storage.labs[index] = lab
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function GetEstimatedResearchTime()
|
||||
-- Base time in seconds for research
|
||||
@@ -29,11 +44,8 @@ end
|
||||
function UpdateLabInfos()
|
||||
local totalLabs = 0
|
||||
local totalSpeed = 0
|
||||
local totalProd = 0
|
||||
for _, surface in pairs(game.surfaces) do
|
||||
local labs = surface.find_entities_filtered{type="lab"}
|
||||
totalLabs = totalLabs + #labs
|
||||
for _, lab in pairs(labs) do
|
||||
totalLabs = #storage.labs
|
||||
for _, lab in pairs(storage.labs) do
|
||||
if lab.valid then
|
||||
if lab.status == defines.entity_status.working then
|
||||
local labBase
|
||||
@@ -48,16 +60,16 @@ function UpdateLabInfos()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
storage.totalLabCount = totalLabs
|
||||
storage.totalResearchSpeed = totalSpeed
|
||||
storage.totalReseachProductivity = totalProd
|
||||
end
|
||||
|
||||
function SendResearchStats()
|
||||
if options.enableResearch == true then
|
||||
UpdateLabInfos()
|
||||
local researchTimeInfo = GetEstimatedResearchTime()
|
||||
if researchTimeInfo then
|
||||
helpers.send_udp(udpAddress, researchTimeInfo, serverIndex)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user