Private
Public Access
1
0

Fixed options

This commit is contained in:
Jan Grießhaber
2026-01-02 00:50:58 +01:00
parent 9256d2d317
commit d803bce9d3
7 changed files with 201 additions and 31 deletions

View File

@@ -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