mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
someone had PFE in an induction matrix so now i've gotta support some bigger numbers in the power format
This commit is contained in:
@ -16,7 +16,7 @@ local config = require("coordinator.config")
|
|||||||
local coordinator = require("coordinator.coordinator")
|
local coordinator = require("coordinator.coordinator")
|
||||||
local renderer = require("coordinator.renderer")
|
local renderer = require("coordinator.renderer")
|
||||||
|
|
||||||
local COORDINATOR_VERSION = "alpha-v0.6.3"
|
local COORDINATOR_VERSION = "alpha-v0.6.4"
|
||||||
|
|
||||||
local print = util.print
|
local print = util.print
|
||||||
local println = util.println
|
local println = util.println
|
||||||
|
@ -364,11 +364,14 @@ local function kFE(fe) return fe / 1000.0 end
|
|||||||
local function MFE(fe) return fe / 1000000.0 end
|
local function MFE(fe) return fe / 1000000.0 end
|
||||||
local function GFE(fe) return fe / 1000000000.0 end
|
local function GFE(fe) return fe / 1000000000.0 end
|
||||||
local function TFE(fe) return fe / 1000000000000.0 end
|
local function TFE(fe) return fe / 1000000000000.0 end
|
||||||
|
local function PFE(fe) return fe / 1000000000000000.0 end
|
||||||
|
local function EFE(fe) return fe / 1000000000000000000.0 end -- if you accomplish this please touch grass
|
||||||
|
local function ZFE(fe) return fe / 1000000000000000000000.0 end -- please stop
|
||||||
|
|
||||||
-- format a power value into XXX.XX UNIT format (FE, kFE, MFE, GFE, TFE)
|
-- format a power value into XXX.XX UNIT format (FE, kFE, MFE, GFE, TFE, PFE, EFE, ZFE)
|
||||||
---@param fe number forge energy value
|
---@param fe number forge energy value
|
||||||
---@param combine_label boolean if a label should be included in the string itself
|
---@param combine_label? boolean if a label should be included in the string itself
|
||||||
---@param format string format override
|
---@param format? string format override
|
||||||
---@return string str, string? unit
|
---@return string str, string? unit
|
||||||
function util.power_format(fe, combine_label, format)
|
function util.power_format(fe, combine_label, format)
|
||||||
local unit
|
local unit
|
||||||
@ -378,21 +381,30 @@ function util.power_format(fe, combine_label, format)
|
|||||||
format = "%.2f"
|
format = "%.2f"
|
||||||
end
|
end
|
||||||
|
|
||||||
if fe < 1000 then
|
if fe < 1000.0 then
|
||||||
unit = "FE"
|
unit = "FE"
|
||||||
value = fe
|
value = fe
|
||||||
elseif fe < 1000000 then
|
elseif fe < 1000000.0 then
|
||||||
unit = "kFE"
|
unit = "kFE"
|
||||||
value = kFE(fe)
|
value = kFE(fe)
|
||||||
elseif fe < 1000000000 then
|
elseif fe < 1000000000.0 then
|
||||||
unit = "MFE"
|
unit = "MFE"
|
||||||
value = MFE(fe)
|
value = MFE(fe)
|
||||||
elseif fe < 1000000000000 then
|
elseif fe < 1000000000000.0 then
|
||||||
unit = "GFE"
|
unit = "GFE"
|
||||||
value = GFE(fe)
|
value = GFE(fe)
|
||||||
else
|
elseif fe < 1000000000000000.0 then
|
||||||
unit = "TFE"
|
unit = "TFE"
|
||||||
value = TFE(fe)
|
value = TFE(fe)
|
||||||
|
elseif fe < 1000000000000000000.0 then
|
||||||
|
unit = "PFE"
|
||||||
|
value = PFE(fe)
|
||||||
|
elseif fe < 1000000000000000000000.0 then
|
||||||
|
unit = "EFE"
|
||||||
|
value = EFE(fe)
|
||||||
|
else
|
||||||
|
unit = "ZFE"
|
||||||
|
value = ZFE(fe)
|
||||||
end
|
end
|
||||||
|
|
||||||
if combine_label then
|
if combine_label then
|
||||||
|
Reference in New Issue
Block a user