mirror of
https://github.com/S4mpsa/InfOS.git
synced 2025-08-04 02:16:05 -04:00
Adding energy usage usecase for multiblocks
This commit is contained in:
parent
c9fc3a1456
commit
1431a0866c
@ -52,4 +52,10 @@ function Parser.parseWorkArea(worAreaString)
|
|||||||
return string.gsub(string.gsub(size, "§a", ""), "§r", "")
|
return string.gsub(string.gsub(size, "§a", ""), "§r", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Parser.parseProbablyUses(probablyUsesString)
|
||||||
|
local noCommaString = string.gsub(probablyUsesString, ",", "")
|
||||||
|
local estimate = string.sub(noCommaString, string.find(noCommaString, "%bc§"))
|
||||||
|
return tonumber((string.gsub(string.gsub(estimate, "c", ""), "§", "")))
|
||||||
|
end
|
||||||
|
|
||||||
return Parser
|
return Parser
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
local adresses = {
|
local adresses = {
|
||||||
EBF11 = "1b05ef68-0fa7-4f94-818d-3e8c079e299d",
|
cleanroom = "753f5619-7076-45c0-8f0a-f3899bae00e1",
|
||||||
cleanroom = "753f5619-7076-45c0-8f0a-f3899bae00e1"
|
EBF11 = "1b05ef68-0fa7-4f94-818d-3e8c079e299d"
|
||||||
}
|
}
|
||||||
|
|
||||||
return adresses
|
return adresses
|
||||||
|
@ -24,4 +24,14 @@ function MultiBlock:getEfficiencyPercentage()
|
|||||||
return Parser.parseEfficiency(sensorInformation[5])
|
return Parser.parseEfficiency(sensorInformation[5])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function MultiBlock:getEnergyUsage() -- EU/t
|
||||||
|
local maxProgress = self:getWorkMaxProgress() or 0
|
||||||
|
if maxProgress > 0 then
|
||||||
|
local sensorInformation = self:getSensorInformation()
|
||||||
|
return Parser.parseProbablyUses(sensorInformation[3])
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return MultiBlock
|
return MultiBlock
|
||||||
|
@ -12,6 +12,7 @@ local function exec(multiblocks)
|
|||||||
|
|
||||||
statuses[multiblock.name] = {
|
statuses[multiblock.name] = {
|
||||||
problems = problems,
|
problems = problems,
|
||||||
|
probablyUses = multiblock:getEnergyUsage(),
|
||||||
efficiencyPercentage = multiblock:getEfficiencyPercentage()
|
efficiencyPercentage = multiblock:getEfficiencyPercentage()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user