diff --git a/hud/init.lua b/hud/init.lua index 523a2c3..b2fff4f 100644 --- a/hud/init.lua +++ b/hud/init.lua @@ -9,7 +9,6 @@ local fluidDisplay = require("hud.fluiddisplay") local component = require("component") local serialization = require("serialization") local colors = require("lib.graphics.colors") -local parser = require("lib.utils.parser") -- local glassData = {} @@ -31,7 +30,7 @@ local function load() local glasses = component.proxy(address) if glasses then ar.clear(glasses) - if data.energyDisplay then table.insert(powerDisplayUsers, {component.proxy(address), {data.xRes or 2560, data.yRes or 1440}, data.scale or 3, data.backgroundColor or colors.darkGray, data.primaryColor or colors.electricBlue, data.accentColor or colors.accentColor}) end + if data.energyDisplay then table.insert(powerDisplayUsers, {component.proxy(address), {data.xRes or 2560, data.yRes or 1440}, data.scale or 3, data.backgroundColor or colors.darkGray, data.primaryColor or colors.electricBlue, data.accentColor or colors.accentColor, data.compactMode}) end if data.fluidDisplay then table.insert(fluidDisplayUsers, {component.proxy(address), {data.xRes or 2560, data.yRes or 1440}, data.scale or 3, data.backgroundColor or colors.darkGray, data.primaryColor or colors.electricBlue, data.accentColor or colors.accentColor}) end if data.toolbar then table.insert(toolbarUsers, {component.proxy(address), {data.xRes or 2560, data.yRes or 1440}, data.scale or 3, data.offset or 0, data.backgroundColor or colors.darkGray, data.primaryColor or colors.electricBlue, data.accentColor or colors.accentColor}) end if data.notifications then table.insert(notificationsUsers, {component.proxy(address), {data.xRes or 2560, data.yRes or 1440}, data.scale or 3, data.offset or 0, data.backgroundColor or colors.darkGray, data.primaryColor or colors.electricBlue, data.accentColor or colors.accentColor}) end @@ -65,7 +64,7 @@ local function save() for address, data in pairs(glassData) do if data.energyDisplay then - table.insert(powerDisplayUsers, {component.proxy(address), {data.xRes or 2560, data.yRes or 1440}, data.scale or 3, data.backgroundColor or colors.darkGray, data.primaryColor or colors.electricBlue, data.accentColor or colors.accentColor}) + table.insert(powerDisplayUsers, {component.proxy(address), {data.xRes or 2560, data.yRes or 1440}, data.scale or 3, data.backgroundColor or colors.darkGray, data.primaryColor or colors.electricBlue, data.accentColor or colors.accentColor, data.compactMode}) powerDisplay.changeColor(address, data.backgroundColor, data.primaryColor, data.accentColor) powerDisplay.remove(address) end @@ -128,6 +127,7 @@ function hud.configure(x, y, gui, graphics, renderer, page) {name = "Resolution (X)", attribute = "xRes", type = "number", defaultValue = 2560}, {name = "Resolution (Y)", attribute = "yRes", type = "number", defaultValue = 1440}, {name = "Scale", attribute = "scale", type = "number", defaultValue = 3}, + {name = "Compact Mode", attribute = "compactMode", type = "boolean", defaultValue = false}, {name = "UTC Offset", attribute = "offset", type = "number", defaultValue = 0}, {name = "Primary Color", attribute = "primaryColor", type = "color", defaultValue = colors.electricBlue}, {name = "Accent Color", attribute = "accentColor", type = "color", defaultValue = colors.magenta}, @@ -185,14 +185,14 @@ local function updateFluidData() local data = fluidMaximums[id] local maximum = 0 if not data then - maximum = getMax(amount) - fluidMaximums[id] = {max=maximum, name=name} + maxium = getMax(amount) + fluidMaximums[id] = {max=maxium, name=name} doSave = true else maximum = data.max if data.max < amount then maxium = getMax(amount) - fluidMaximums[id] = {max=maximum, name=name} + fluidMaximums[id] = {max=maxium, name=name} doSave = true end end @@ -207,34 +207,6 @@ local function updateFluidData() saveFluidData() end end - - -- YOTT tanks - for address, _ in pairs(component.list("gt_machine")) do - local info = component.proxy(address).getSensorInformation() - if (info[1] == "Fluid Name:") then - local name = parser.stripColors(info[2]) - local id = string.lower(string.gsub(name, " ", "")) - local amount = parser.getInteger(info[6]) / 10 - local capacity = parser.getInteger(info[4]) - local data = fluidMaximums[id] - local maximum = 0 - - if not data then - maximum = getMax(capacity) - fluidMaximums[id] = {max=maximum, name=name} - doSave = true - else - maximum = data.max - if data.max ~= amount then - maximum = getMax(capacity) - fluidMaximums[id] = {max=maximum, name=name} - doSave = true - end - end - - fluidData[id] = {amount=amount, name=name, max=maximum, id=id} - end - end end function hud.updateFluidSettings() diff --git a/hud/powerdisplay.lua b/hud/powerdisplay.lua index 2570eae..e463ac6 100644 --- a/hud/powerdisplay.lua +++ b/hud/powerdisplay.lua @@ -36,7 +36,7 @@ end local function getMaxEU() file = io.open("/home/NIDAS/settings/maxWireless", "r") - local maxValue = 10e5 + local maxValue = 0 if file ~= nil then local data = serialization.unserialize(file:read("*a")) if maxValue then @@ -206,8 +206,9 @@ function powerDisplay.widget(glasses, data) borderColor = glasses[i][4] or colors.darkGray, primaryColor = glasses[i][5] or colors.electricBlue, accentColor = glasses[i][6] or colors.magenta, - width = glasses[i][7] or 0, - heigth = glasses[i][8] or 29 + width = 0, + heigth = 29, + compactMode = glasses[i][7] or false }) end end @@ -216,7 +217,7 @@ function powerDisplay.widget(glasses, data) if hudObjects[i].width == 0 then hudObjects[i].width = screen.size(hudObjects[i].resolution, hudObjects[i].scale)[1]/2 - 91 end local h = hudObjects[i].heigth local w = hudObjects[i].width - local compact = w < 250 + local compact = (w < 250) or hudObjects[i].compactMode local x = 0 local y = screen.size(hudObjects[i].resolution, hudObjects[i].scale)[2] - h local hProgress = math.ceil(h * 0.4) diff --git a/nidas_version.lua b/nidas_version.lua index a987d9d..aa3688e 100644 --- a/nidas_version.lua +++ b/nidas_version.lua @@ -1 +1 @@ -return "1.51" \ No newline at end of file +return "1.52" \ No newline at end of file