{"slots":{"0":{"name":"slot1","type":{"events":[],"methods":[]}},"1":{"name":"slot2","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"slot4","type":{"events":[],"methods":[]}},"4":{"name":"slot5","type":{"events":[],"methods":[]}},"5":{"name":"slot6","type":{"events":[],"methods":[]}},"6":{"name":"slot7","type":{"events":[],"methods":[]}},"7":{"name":"slot8","type":{"events":[],"methods":[]}},"8":{"name":"slot9","type":{"events":[],"methods":[]}},"9":{"name":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"evaluateButtons(x, y, false, slot3)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"2"},"key":"0"},{"code":"evaluateButtons(x, y, false, slot4)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"3"},"key":"1"},{"code":"evaluateButtons(x, y, false, slot5)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"4"},"key":"2"},{"code":"evaluateButtons(x, y, false, slot6)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"5"},"key":"3"},{"code":"evaluateButtons(x, y, false, slot7)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"6"},"key":"4"},{"code":"evaluateButtons(x, y, false, slot8)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"7"},"key":"5"},{"code":"evaluateButtons(x, y, false, slot9)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"8"},"key":"6"},{"code":"evaluateButtons(x, y, false, slot10)","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseUp(x,y)","slotKey":"9"},"key":"7"},{"code":"generateHtml(true)","filter":{"args":[{"value":"updateTable"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"8"},{"code":"-- unit needs to have 2 filters: timer, start()\n-- for timer filter set its name as updateTable and inside needs to contain generateHtml()\n-- start filter needs to contain all of this code\n\n\nhub = 1664400 --export: This is the total volume of your hub, at present, all hubs need to be the same\ncontainerProficiency = 30 --export: This is the % voume increase of your Container Proficiency talent\ncontainerOptimization = 0 --export: This is the % mass decrease of your Container Optimization talent\n\n\nsortedOres = {}\nores = {}\npures = {}\n\nscreens = {}\ncore = nil\ndatabank = nill\n\nfontBigSize = \"90px\"\nfontSize = \"50px\"\nfontSizeBigMini = \"60px\"\nfontSizeMini = \"40px\"\n\nbarWidth = 290\nbarWidthBig = 450\nbarHeight = 60\nbarHeightBig = 90\nlineGap = 60\nlineGapBig = 90\n\nscreenWidth = 1920\nscreenHeight = 1150\n\nfunction round(number,decimals)\n local power = 10^decimals\n return math.floor((number/1000) * power) / power\nend\n\nfunction ContainerMaxVol(hp)\n if hp > 49 and hp <=123 then vol = hub\n elseif hp > 123 and hp <= 998 then vol = (1000+(1000*(containerProficiency/100)))\n elseif hp > 998 and hp <= 7996 then vol = (8000+(8000*(containerProficiency/100)))\n elseif hp > 7996 and hp <= 17315 then vol = (64000+(64000*(containerProficiency/100)))\n elseif hp > 17315 then vol = (128000+(128000*(containerProficiency/100)))\n end\n return vol\nend\n\nfunction ContainerSelfMass(hp)\n if hp > 49 and hp <=123 then sm = 0\n elseif hp > 123 and hp <= 998 then sm = 229.09\n elseif hp > 998 and hp <= 7996 then sm = 1280\n elseif hp > 7996 and hp <= 17315 then sm = 7420\n elseif hp > 17315 then sm = 14840\n end\n return sm\nend\n\nfunction addPure(pure)\n pures[string.lower(\"Pure \"..pure.name)] = pure\nend\n\nfunction addOre(ore)\n ores[string.lower(ore.name..\" Ore\")] = ore\n sortedOres[#sortedOres+1] = ore\n addPure(ore.into)\nend\n\naddPure({name = \"Oxygen\", tier = 1, weight = 1})\naddPure({name = \"Hydrogen\", tier = 1, weight = 0.07})\n\naddOre({name = \"Bauxite\", tier = 1, weight = 1.28, into = {name = \"Aluminium\", weight = 2.65}})\naddOre({name = \"Coal\", tier = 1, weight = 1.35, into = {name = \"Carbon\", weight = 2.27}})\naddOre({name = \"Hematite\", tier = 1, weight = 5.04, into = {name = \"Iron\", weight = 7.85}})\naddOre({name = \"Quartz\", tier = 1, weight = 2.65, into = {name = \"Silicon\", weight = 2.33}})\n\naddOre({name = \"Chromite\", tier = 2, weight = 4.54, into = {name = \"Chromium\", weight = 7.19}})\naddOre({name = \"Malachite\", tier = 2, weight = 4.00, into = {name = \"Copper\", weight = 8.96}})\naddOre({name = \"Limestone\", tier = 2, weight = 2.71, into = {name = \"Calcium\", weight = 1.55}})\naddOre({name = \"Natron\", tier = 2, weight = 1.55, into = {name = \"Sodium\", weight = 0.97}})\n\naddOre({name = \"Garnierite\", tier = 3, weight = 2.60, into = {name = \"Nickel\", weight = 8.91}})\naddOre({name = \"Petalite\", tier = 3, weight = 2.41, into = {name = \"Lithium\", weight = 0.53}})\naddOre({name = \"Acanthite\", tier = 3, weight = 7.20, into = {name = \"Silver\", weight = 10.49}})\naddOre({name = \"Pyrite\", tier = 3, weight = 5.01, into = {name = \"Sulfur\", weight = 1.82}})\n\naddOre({name = \"Cobaltite\", tier = 4, weight = 6.33, into = {name = \"Cobalt\", weight = 8.90}})\naddOre({name = \"Cryolite\", tier = 4, weight = 2.95, into = {name = \"Fluorine\", weight = 1.70}})\naddOre({name = \"Gold nuggets\", tier = 4, weight = 19.30, into = {name = \"Gold\", weight = 19.30}})\naddOre({name = \"Kolbeckite\", tier = 4, weight = 2.37, into = {name = \"Scandium\", weight = 2.98}})\n\naddOre({name = \"Rhodonite\", tier = 5, weight = 3.76, into = {name = \"Manganese\", weight = 7.21}})\naddOre({name = \"Columbite\", tier = 5, weight = 5.38, into = {name = \"Niobium\", weight = 8.57}})\naddOre({name = \"Illmenite\", tier = 5, weight = 4.55, into = {name = \"Titanium\", weight = 4.51}})\naddOre({name = \"Vanadinite\", tier = 5, weight = 6.95, into = {name = \"Vanadium\", weight = 6.0}})\n\n\n\n\n\nfor key, value in pairs(unit) do\n if type(value) == \"table\" and type(value.export) == \"table\" then\n if value.getElementClass then\n if value.getElementClass() == \"ScreenUnit\" then\n screens[#screens + 1] = {screen = value, slot = key, settings = {verticalView = true, renderSettings = false, generatebackground = true, tierSettings = {}},\n settingsButton = {x = 0, y = 0, size = 70},\n button = {x = 400, y = 0, size = 50},\n barColorMode = {x = 100, y = 0, size = 50},\n barBColorMode = {x = 150, y = 0, size = 50},\n barTColorMode = {x = 200, y = 0, size = 50},\n barMColorMode = {x = 250, y = 0, size = 50},\n background = {x = 300, y = 0, size = 50},\n applyToAll = {x = 350, y = 0, size = 50},\n\n resetButton = {x = screenWidth-160, y = 0, size = 50, sizeY = 150},\n tiers = {},\n showTier = -1}\n\n for i = -1, 5 do\n screens[#screens].settings.tierSettings[i] = {}\n end\n screens[#screens].settings.tierSettings[-1] = {barTColorMode = 6}\n\n\n elseif value.getElementClass() == \"CoreUnitStatic\" or value.getElementClass() == \"CoreUnitSpace\" then\n core = value\n elseif value.getElementClass() == \"DataBankUnit\" then\n databank = value\n end\n end\n end\nend\n\nunit.hide()\n\nfunction split(s, delimiter)\n result = {};\n for match in (s..delimiter):gmatch(\"(.-)\"..delimiter) do\n table.insert(result, match);\n end\n return result;\nend\n\nif databank then\n for _,key in ipairs(json.decode(databank.getKeys())) do\n value = databank.getIntValue(key)\n\n for _,screenObject in ipairs(screens) do\n if string.match(key, screenObject.slot) then\n\n splitted = split(key, \"_\")\n lastPart = splitted[#splitted]\n\n if lastPart == \"orent\" then\n screenObject.settings.verticalView = value == 1\n elseif lastPart == \"tier\" then\n screenObject.showTier = value\n end\n\n if value > -2 then\n for i = -1, 5 do\n if lastPart == \"barColorMode\"..i then\n screenObject.settings.tierSettings[i].barColorMode = value\n elseif lastPart == \"barBColorMode\"..i then\n screenObject.settings.tierSettings[i].barBColorMode = value\n elseif lastPart == \"barTColorMode\"..i then\n screenObject.settings.tierSettings[i].barTColorMode = value\n elseif lastPart == \"barMColorMode\"..i then\n screenObject.settings.tierSettings[i].barMColorMode = value\n elseif lastPart == \"background\"..i then\n screenObject.settings.tierSettings[i].background = value\n end\n end\n end\n end\n end\n end\nend\n\n-- Turning on Screens\nfor _,screenObject in ipairs(screens) do\n screenObject.screen.activate()\nend\n\nfunction displayOff()\n for _,screenObject in ipairs(screens) do\n screenObject.screen.clear()\n end\nend\n\nelementsIds = core.getElementIdList()\n\nfor i = 1, #elementsIds do\n local name = string.lower(core.getElementNameById(elementsIds[i]))\n if string.match(core.getElementTypeById(elementsIds[i]), \"ontainer\") and (string.match(name,\" ore\") or string.match(name,\"pure \")) then\n local got = ores[name]\n if got == nil then\n got = pures[name]\n end\n if got ~= nil then\n\n if got.containers == nill then\n got.containers = {}\n end\n\n hitPoints = core.getElementMaxHitPointsById(elementsIds[i])\n\n got.containers[#got.containers+1] = {id = elementsIds[i], hitPoints = hitPoints, selfMass = ContainerSelfMass(hitPoints), maxVol = ContainerMaxVol(hitPoints)}\n end\n end\nend\n\n\nfunction OptimizedContainerMass(mass)\n oMass = (mass+(mass*(containerOptimization/100)))\n return oMass\nend\n\nfunction getRGB(percentage)\n return {(255 * percentage) / 100, (255 * (100 - percentage)) / 100, (255 * (100 - percentage)) / 100}\nend\n\nfunction rgbToHex(rgb)\n local hexadecimal = ''\n for key, value in pairs(rgb) do\n local hex = ''\n while(value > 0)do\n local index = math.floor(math.fmod(value, 16) + 1)\n value = math.floor(value / 16)\n hex = string.sub('0123456789ABCDEF', index, index) .. hex\n end\n if(string.len(hex) == 0)then\n hex = '00'\n elseif(string.len(hex) == 1)then\n hex = '0' .. hex\n end\n hexadecimal = hexadecimal .. hex\n end\n return hexadecimal\nend\n\nfunction addBBC(color)\n pbarBackgroundColors[#pbarBackgroundColors+1] = {color = color, border = \"464646\"}\n pbarBackgroundColors[#pbarBackgroundColors+1] = {color = color, border = \"fad47a\"}\n pbarBackgroundColors[#pbarBackgroundColors+1] = {color = color, border = \"8c9698\"}\n pbarBackgroundColors[#pbarBackgroundColors+1] = {color = color, border = \"ffffff\"}\nend\npbarBackgroundColors = {}\naddBBC(\"ffffff\")\naddBBC(\"464646\")\naddBBC(\"b6dfed\")\naddBBC(\"05e4ff\")\naddBBC(\"fad47a\")\naddBBC(\"8c9698\")\naddBBC(\"142027\")\n\nfunction addTC(color)\n pbarTextColors[#pbarTextColors+1] = {color = color, border = \"484848\"}\n pbarTextColors[#pbarTextColors+1] = {color = color, border = \"BFC0C1\"}\n pbarTextColors[#pbarTextColors+1] = {color = color}\nend\npbarTextColors = {}\naddTC(\"ffffff\")\naddTC(\"464646\")\naddTC(\"b6dfed\")\naddTC(\"05e4ff\")\naddTC(\"fad47a\")\naddTC(\"8c9698\")\naddTC(\"142027\")\n\nbackground = {}\nbackground[#background+1] = {color = \"2C3735\"}\nbackground[#background+1] = {color = \"f3f3f3\"}\nbackground[#background+1] = {color = \"484848\"}\nbackground[#background+1] = {color = \"464646\"}\nbackground[#background+1] = {color = \"b6dfed\"}\nbackground[#background+1] = {color = \"05e4ff\"}\nbackground[#background+1] = {color = \"8c9698\"}\nbackground[#background+1] = {color = \"fad47a\"}\nbackground[#background+1] = {color = \"142027\"}\nbackground[#background+1] = {color = \"DE354C\"}\nbackground[#background+1] = {color = \"932432\"}\nbackground[#background+1] = {color = \"3C1874\"}\nbackground[#background+1] = {color = \"283747\"}\nbackground[#background+1] = {color = \"F3F3F3\"}\nbackground[#background+1] = {color = \"DCE1E3\"}\nbackground[#background+1] = {color = \"283747\"}\nbackground[#background+1] = {color = \"5C5F58\"}\nbackground[#background+1] = {color = \"266150\"}\nbackground[#background+1] = {color = \"4F4846\"}\nbackground[#background+1] = {color = \"12232E\"}\nbackground[#background+1] = {color = \"FFDF6C\"}\nbackground[#background+1] = {color = \"202020\"}\nbackground[#background+1] = {color = \"164A41\"}\nbackground[#background+1] = {color = \"4D774E\"}\nbackground[#background+1] = {color = \"9DC88D\"}\nbackground[#background+1] = {color = \"A3BCB6\"}\nbackground[#background+1] = {color = \"A28089\"}\nbackground[#background+1] = {color = \"8458B3\"}\nbackground[#background+1] = {color = \"ff1e00\"}\nbackground[#background+1] = {color = \"e8f9fd\"}\n\n\nfunction getHex(percentage, mode)\n if mode == 1 then\n rgb = {(255 * percentage) / 100, (255 * (100 - percentage)) / 100, 0}\n elseif mode == 2 then\n rgb = {(255 * percentage) / 100, (255 * (100 - percentage)) / 100, (255 * (100 - percentage)) / 100}\n elseif mode == 3 then\n rgb = {(255 * percentage) / 100, (255 * (100 - percentage)) / 100, (255 * percentage) / 100}\n elseif mode == 4 then\n rgb = {0, (255 * (100 - percentage)) / 100, (255 * percentage) / 100}\n elseif mode == 5 then\n rgb = {(255 * percentage) / 100, 0, (255 * percentage) / 100}\n elseif mode == 6 then\n rgb = {(255 * percentage) / 100, 125,0}\n elseif mode == 7 then\n rgb = {125, 125, (255 * percentage) / 100}\n -- elseif mode == 8 then\n -- return \"b6dfed\"\n -- elseif mode == 9 then\n -- return \"05e4ff\"\n -- elseif mode == 10 then\n -- return \"8c9698\"\n -- elseif mode == 11 then\n -- return \"fad47a\"\n -- elseif mode == 12 then\n -- return \"142027\"\n\n elseif #background> mode - 7 then\n return background[mode - 7].color\n else\n rgb = {125, 125, 125}\n end\n return rgbToHex(rgb)\nend\n\nfunction barGraphColor(percentage, invert, mode)\n if percentage == nil then percentage = 0 end\n if invert then\n return getHex(percentage, mode)\n end\n return getHex(100 - percentage, mode)\nend\n\n\n\nfunction updateStyle(screenObject)\n\n local iconStyle = [[\n ]]\nend\n\nfunction generateLine(startingY, startingX, ore, percent, mass, invert, rightSide, textOnTop, screenObject, single, oretier)\n local line = \"\"\n local background = \"\"\n startingX = math.floor(startingX)\n startingY = math.floor(startingY)\n if percent > 100 then\n percent = 100\n end\n if percent < 0 then\n percent = 0\n end\n\n if screenObject.settings.generatebackground then\n colorMMode = screenObject.settings.tierSettings[oretier].barMColorMode\n if colorMMode == nil then\n colorMMode = screenObject.settings.tierSettings[-1].barMColorMode\n end\n if colorMMode == nil then\n colorMMode = 1\n end\n end\n\n if single then\n\n if textOnTop then\n if screenObject.settings.generatebackground then\n background = [[]]..ore.name..[[]]\n end\n startingY = startingY + barHeightBig-1\n else\n if screenObject.settings.generatebackground then\n if rightSide then\n background = [[]]..ore.name..[[]]\n else\n background = [[]]..ore.name..[[]]\n end\n end\n end\n\n else\n if textOnTop then\n if screenObject.settings.generatebackground then\n background = [[]]..ore.name..[[]]\n end\n startingY = startingY + barHeight-1\n else\n if screenObject.settings.generatebackground then\n if rightSide then\n background = [[]]..ore.name..[[]]\n else\n background = [[]]..ore.name..[[]]\n end\n end\n end\n end\n\n if screenObject.settings.generatebackground then\n\n colorBMode = screenObject.settings.tierSettings[oretier].barBColorMode\n if colorBMode == nil or colorBMode == -2 then\n colorBMode = screenObject.settings.tierSettings[-1].barBColorMode\n end\n if colorBMode == nil or colorBMode == -2 then\n colorBMode = 1\n end\n if single then\n background = background..[[]]\n else\n background = background..[[]]\n end\n end\n\n local colorMode = screenObject.settings.tierSettings[oretier].barColorMode\n if colorMode == nil then\n colorMode = screenObject.settings.tierSettings[-1].barColorMode\n end\n if colorMode == nil then\n colorMode = 1\n end\n\n colorTMode = screenObject.settings.tierSettings[oretier].barTColorMode\n if colorTMode == nil then\n colorTMode = screenObject.settings.tierSettings[-1].barTColorMode\n end\n if colorTMode == nil then\n colorTMode = 1\n end\n\n if single then\n if percent > 0 then\n line = line..[[]]\n end\n line = line..[[]]..percent..[[%]]\n line = line..[[]]..mass..[[KL]]\n else\n if percent > 0 then\n line = line..[[]]\n end\n line = line..[[]]..percent..[[%]]\n line = line..[[]]..mass..[[KL]]\n end\n return line, background\nend\n\nfunction save(screenObject)\n if databank then\n for tier = -1, 5 do\n tierSetting = screenObject.settings.tierSettings[tier]\n if (tierSetting.barTColorMode ~= nill) then\n databank.setIntValue(screenObject.slot..\"_barTColorMode\"..tier, tierSetting.barTColorMode)\n end\n\n if (tierSetting.barBColorMode ~= nill) then\n databank.setIntValue(screenObject.slot..\"_barBColorMode\"..tier, tierSetting.barBColorMode)\n end\n\n if (tierSetting.barColorMode ~= nill) then\n databank.setIntValue(screenObject.slot..\"_barColorMode\"..tier, tierSetting.barColorMode)\n end\n\n if (tierSetting.barMColorMode ~= nill) then\n databank.setIntValue(screenObject.slot..\"_barMColorMode\"..tier, tierSetting.barMColorMode)\n end\n\n if (tierSetting.background ~= nill) then\n databank.setIntValue(screenObject.slot..\"_background\"..tier, tierSetting.background)\n end\n end\n\n\n if screenObject.settings.verticalView then\n databank.setIntValue(screenObject.slot..\"_orent\", 1)\n else\n databank.setIntValue(screenObject.slot..\"_orent\", 0)\n end\n if databank then\n databank.setIntValue(screenObject.slot..\"_tier\", screenObject.showTier)\n end\n end\nend\n\nfunction saveAll()\n if databank then\n databank.clear()\n for _,screenObject in ipairs(screens) do\n save(screenObject)\n end\n end\nend\n\nfunction evaluateButtons(x, y, pressDown, unit)\n x = screenWidth * x\n y = screenHeight * y\n for _,screenObject in ipairs(screens) do\n if screenObject.screen.getId() == unit.getId() then\n if screenObject.button.x <= x and screenObject.button.x+ screenObject.button.size >= x and screenObject.button.y <= y and screenObject.button.y+ screenObject.button.size >= y and not pressDown then\n screenObject.settings.verticalView = not screenObject.settings.verticalView\n if databank then\n if screenObject.settings.verticalView then\n databank.setIntValue(screenObject.slot..\"_orent\", 1)\n else\n databank.setIntValue(screenObject.slot..\"_orent\", 0)\n end\n screenObject.settings.generatebackground = true\n end\n generateHtml(false)\n break\n end\n\n\n if screenObject.settingsButton.x <= x and screenObject.settingsButton.x+ screenObject.settingsButton.size >= x and\n screenObject.settingsButton.y <= y and screenObject.settingsButton.y+ screenObject.settingsButton.size >= y and not pressDown then\n screenObject.settings.renderSettings = not screenObject.settings.renderSettings\n screenObject.settings.generatebackground = true\n generateHtml(false)\n break\n end\n\n if screenObject.settings.renderSettings then\n if screenObject.barColorMode.x <= x and screenObject.barColorMode.x+ screenObject.barColorMode.size >= x and\n screenObject.barColorMode.y <= y and screenObject.barColorMode.y+ screenObject.barColorMode.size >= y and not pressDown then\n local colorMode = screenObject.settings.tierSettings[screenObject.showTier].barColorMode\n\n if colorMode == nil then\n colorMode = 2\n else\n colorMode = colorMode + 1\n end\n\n if colorMode > 7 + #background then\n colorMode = 1\n end\n\n screenObject.settings.tierSettings[screenObject.showTier].barColorMode = colorMode\n\n if databank then\n databank.setIntValue(screenObject.slot..\"_barColorMode\"..screenObject.showTier, colorMode)\n screenObject.settings.generatebackground = true\n end\n generateHtml(false)\n break\n end\n\n if screenObject.barBColorMode.x <= x and screenObject.barBColorMode.x+ screenObject.barBColorMode.size >= x and\n screenObject.barBColorMode.y <= y and screenObject.barBColorMode.y+ screenObject.barBColorMode.size >= y and not pressDown then\n local colorMode = screenObject.settings.tierSettings[screenObject.showTier].barBColorMode\n\n if colorMode == nil then\n colorMode = 2\n else\n colorMode = colorMode + 1\n end\n\n if colorMode > #pbarBackgroundColors then\n colorMode = 1\n end\n\n screenObject.settings.tierSettings[screenObject.showTier].barBColorMode = colorMode\n\n if databank then\n databank.setIntValue(screenObject.slot..\"_barBColorMode\"..screenObject.showTier, colorMode)\n screenObject.settings.generatebackground = true\n end\n generateHtml(false)\n break\n end\n\n if screenObject.barTColorMode.x <= x and screenObject.barTColorMode.x+ screenObject.barTColorMode.size >= x and\n screenObject.barTColorMode.y <= y and screenObject.barTColorMode.y+ screenObject.barTColorMode.size >= y and not pressDown then\n local colorMode = screenObject.settings.tierSettings[screenObject.showTier].barTColorMode\n\n if colorMode == nil then\n colorMode = 7\n else\n colorMode = colorMode + 1\n end\n\n if colorMode > #pbarTextColors then\n colorMode = 1\n end\n\n screenObject.settings.tierSettings[screenObject.showTier].barTColorMode = colorMode\n\n if databank then\n databank.setIntValue(screenObject.slot..\"_barTColorMode\"..screenObject.showTier, colorMode)\n screenObject.settings.generatebackground = true\n end\n generateHtml(false)\n break\n end\n\n if screenObject.barMColorMode.x <= x and screenObject.barMColorMode.x+ screenObject.barMColorMode.size >= x and\n screenObject.barMColorMode.y <= y and screenObject.barMColorMode.y+ screenObject.barMColorMode.size >= y and not pressDown then\n local colorMode = screenObject.settings.tierSettings[screenObject.showTier].barMColorMode\n\n if colorMode == nil then\n colorMode = 2\n else\n colorMode = colorMode + 1\n end\n\n if colorMode > #pbarTextColors then\n colorMode = 1\n end\n\n screenObject.settings.tierSettings[screenObject.showTier].barMColorMode = colorMode\n\n if databank then\n databank.setIntValue(screenObject.slot..\"_barMColorMode\"..screenObject.showTier, colorMode)\n screenObject.settings.generatebackground = true\n end\n generateHtml(false)\n break\n end\n\n if screenObject.background.x <= x and screenObject.background.x+ screenObject.background.size >= x and\n screenObject.background.y <= y and screenObject.background.y+ screenObject.background.size >= y and not pressDown then\n local colorMode = screenObject.settings.tierSettings[screenObject.showTier].background\n\n if colorMode == nil then\n colorMode = 2\n else\n colorMode = colorMode + 1\n end\n\n if colorMode > #background then\n colorMode = 1\n end\n\n screenObject.settings.tierSettings[screenObject.showTier].background = colorMode\n\n if databank then\n databank.setIntValue(screenObject.slot..\"_background\"..screenObject.showTier, colorMode)\n screenObject.settings.generatebackground = true\n end\n generateHtml(false)\n break\n end\n\n -- Apply To All Screens\n if screenObject.applyToAll.x <= x and screenObject.applyToAll.x+ screenObject.applyToAll.size >= x and\n screenObject.applyToAll.y <= y and screenObject.applyToAll.y+ screenObject.applyToAll.size >= y and not pressDown then\n\n for id_,screenObject_ in ipairs(screens) do\n if screenObject.screen.getId() ~= screenObject_.screen.getId() then\n\n screenObject_.settings.tierSettings = {}\n for i = -1, 5 do\n screenObject_.settings.tierSettings[i] = {}\n end\n screenObject_.settings.tierSettings[-1] = {barTColorMode = 6}\n\n for tier = -1, 5 do\n tierSetting = screenObject.settings.tierSettings[tier]\n if (tierSetting.barTColorMode ~= nill and tierSetting.barTColorMode ~= -2) then\n screenObject_.settings.tierSettings[tier].barTColorMode = tierSetting.barTColorMode\n end\n\n if (tierSetting.barBColorMode ~= nill and tierSetting.barBColorMode ~= -2) then\n screenObject_.settings.tierSettings[tier].barBColorMode = tierSetting.barBColorMode\n end\n\n if (tierSetting.barColorMode ~= nill and tierSetting.barColorMode ~= -2) then\n screenObject_.settings.tierSettings[tier].barColorMode = tierSetting.barColorMode\n end\n\n if (tierSetting.barMColorMode ~= nill and tierSetting.barMColorMode ~= -2) then\n screenObject_.settings.tierSettings[tier].barMColorMode = tierSetting.barMColorMode\n end\n\n if (tierSetting.background ~= nill and tierSetting.background ~= -2) then\n screenObject_.settings.tierSettings[tier].background = tierSetting.background\n end\n end\n\n\n screenObject_.settings.generatebackground = true\n end\n end\n\n saveAll()\n generateHtml(false)\n break\n end\n\n width = screenObject.resetButton.size\n if screenObject.resetButton.sizeY ~= nill then\n width = screenObject.resetButton.sizeY\n end\n if screenObject.resetButton.x <= x and screenObject.resetButton.x+ screenObject.resetButton.size >= x and\n screenObject.resetButton.y <= y and screenObject.resetButton.y+ screenObject.resetButton.width >= y and not pressDown then\n\n for i = -1, 5 do\n screenObject.settings.tierSettings[i] = {}\n end\n screenObject.settings.tierSettings[-1] = {barTColorMode = 6}\n\n if databank then\n\n databank.setIntValue(screenObject.slot..\"_barTColorMode\"..screenObject.showTier, -2)\n databank.setIntValue(screenObject.slot..\"_barBColorMode\"..screenObject.showTier, -2)\n databank.setIntValue(screenObject.slot..\"_barColorMode\"..screenObject.showTier, -2)\n databank.setIntValue(screenObject.slot..\"_barMColorMode\"..screenObject.showTier, -2)\n databank.setIntValue(screenObject.slot..\"_background\"..screenObject.showTier, -2)\n\n end\n\n screenObject.settings.generatebackground = true\n generateHtml(false)\n break\n end\n end\n\n\n oldTier = screenObject.showTier\n\n\n if (screenObject.showTier == -1) then\n for id,tiers in ipairs(screenObject.tiers) do\n if tiers.x1 <= x and tiers.x2 >= x and tiers.y1 <= y and tiers.y2 >= y and not pressDown then\n screenObject.showTier = id\n if databank then\n databank.setIntValue(screenObject.slot..\"_tier\", id)\n end\n break\n end\n end\n\n if screenObject.tiers[0] and screenObject.tiers[0].x1 <= x and screenObject.tiers[0].x2 >= x and screenObject.tiers[0].y1 <= y and screenObject.tiers[0].y2 >= y and not pressDown then\n screenObject.showTier = 0\n if databank then\n databank.setIntValue(screenObject.slot..\"_tier\", 0)\n end\n end\n else\n if databank then\n databank.setIntValue(screenObject.slot..\"_tier\", -1)\n end\n screenObject.showTier = -1\n end\n\n if screenObject.showTier ~= oldTier then\n screenObject.settings.generatebackground = true\n generateHtml(false)\n end\n\n end\n end\nend\n\nfunction getMass(element)\n mass = 0\n maxVol = 0\n for _,container in ipairs(element.containers) do\n mass = mass+round(math.ceil((OptimizedContainerMass(core.getElementMassById(container.id)) - container.selfMass) / element.weight), 1)\n maxVol = maxVol + container.maxVol\n end\n return mass, maxVol\nend\n\nfunction optionColorButton(colormode, fill, border, button, y)\n local bhtml = \"\"\n if fill ~= nil then\n\n width = button.size\n if button.sizeY ~= nill then\n width = button.sizeY\n end\n\n bhtml = [[]]\n end\n if border ~= nil then\n bhtml = bhtml..[[]]\n end\n bhtml = bhtml..[[]]..colormode..[[]]\n return bhtml\nend\n\ncounter = 0\n\nfunction generateHtml(auto)\n\n if auto then\n counter = counter + 1\n end\n\n\n for id,screenObject in ipairs(screens) do\n\n startingY = 0\n\n if screenObject.settings.verticalView then\n startingY = -math.floor((screenWidth - screenHeight) /2)\n end\n\n bhtml = \"\"\n\n html = \"\"\n html = html..[[]]\n\n\n html = html..[[]]\n\n\n if screenObject.settings.verticalView then\n html = html..[[]]\n if screenObject.settings.generatebackground then\n bhtml = bhtml..[[]]\n end\n end\n\n if screenObject.settings.generatebackground then\n backgroundColor = screenObject.settings.tierSettings[screenObject.showTier].background\n\n if backgroundColor == nill then\n backgroundColor = screenObject.settings.tierSettings[-1].background\n end\n if backgroundColor ~= nill and backgroundColor ~= -2 then\n backgroundColor = background[backgroundColor]\n end\n\n if backgroundColor == nill then\n backgroundColor = background[1]\n end\n end\n\n if screenObject.settings.verticalView then\n if screenObject.settings.generatebackground then\n bhtml = bhtml..[[]]\n end\n startingY = startingY + 70\n else\n if screenObject.settings.generatebackground then\n bhtml = bhtml..[[]]\n end\n end\n\n\n\n\n single = screenObject.showTier ~= -1\n\n line = 1\n\n textOnTop = not screenObject.settings.verticalView and not single or screenObject.settings.verticalView and single\n\n\n if single then\n startingY = math.floor(screenHeight/2)\n end\n\n if screenObject.showTier == -1 or screenObject.showTier == 0 then\n oxygen = pures[string.lower(\"Pure Oxygen\")]\n\n if oxygen.containers ~= nil then\n local pure = oxygen\n massPure, maxVol = getMass(pure)\n percentPure = math.ceil(((math.ceil((massPure * 1000) - 0.5) / maxVol)*100))\n\n oxyY = startingY + lineGap\n if single then\n if not screenObject.settings.verticalView then\n oxyY = startingY - lineGap\n end\n end\n\n mainhtml, backc = generateLine(oxyY, screenWidth/2, pure, percentPure, massPure, true, false, single, screenObject, single, 0)\n html = html..mainhtml\n\n bhtml = bhtml..backc\n\n if screenObject.settings.generatebackground then\n screenObject.tiers[0] = {x1 = screenWidth/2 - (barWidth* 1.3), x2 = screenWidth/2 + (barWidth* 1.3), y1 = startingY -5, y2 = startingY + barHeight}\n end\n end\n\n hydrogen = pures[string.lower(\"Pure Hydrogen\")]\n if hydrogen.containers ~= nil then\n local pure = hydrogen\n massPure, maxVol = getMass(pure)\n percentPure = math.ceil(((math.ceil((massPure * 1000) - 0.5) / maxVol)*100))\n\n\n centerPoint = screenWidth/2+barWidth+10\n if single then\n centerPoint = screenWidth/2+barWidthBig+10\n end\n\n oxyY = startingY + lineGap\n if single then\n if not screenObject.settings.verticalView then\n oxyY = startingY - lineGap\n end\n end\n\n mainhtml, backc = generateLine(oxyY, centerPoint, pure, percentPure, massPure, true, true, single, screenObject, single, 0)\n\n html = html..mainhtml\n\n bhtml = bhtml..backc\n\n if screenObject.settings.generatebackground then\n screenObject.tiers[0] = {x1 = screenWidth/2 - (barWidth* 1.3), x2 = screenWidth/2 + (barWidth* 1.3), y1 = startingY -5, y2 = startingY + barHeight}\n end\n end\n\n if oxygen ~= nil or hydrogen ~= nill then\n startingY = startingY + lineGap+20\n end\n end\n\n tier = 0\n\n centerPoint = -(screenWidth / 6)\n\n if screenObject.settings.verticalView or single then\n centerPoint = screenWidth/2\n end\n\n if single then\n if screenObject.settings.verticalView then\n startingY = screenHeight/2-(barHeightBig*4)\n else\n startingY = screenHeight/2-(barHeightBig*2)\n end\n end\n\n originalStartingY = startingY\n\n\n collumn = 1\n\n lowestY = 0\n\n\n for k, ore in pairs(sortedOres) do\n if (ore.containers ~= nil or ore.into.containers ~= nil) and (screenObject.showTier == -1 or ore.tier == screenObject.showTier) then\n\n\n\n startingY = startingY + lineGap\n\n if lowestY < startingY then\n lowestY = startingY\n end\n\n\n if tier ~= ore.tier then\n\n if not screenObject.settings.verticalView then\n centerPoint = centerPoint + (screenWidth / 6) * 2\n if collumn == 4 then\n collumn = 1\n centerPoint = screenWidth / 3\n originalStartingY = lowestY - lineGap + 20\n startingY = lowestY + 20\n else\n startingY = originalStartingY + lineGap\n end\n else\n startingY = startingY + 20\n end\n\n startingY = startingY + 50\n\n if screenObject.settings.generatebackground then\n\n colorMMode = screenObject.settings.tierSettings[ore.tier].barMColorMode\n if colorMMode == nil then\n colorMMode = screenObject.settings.tierSettings[-1].barMColorMode\n end\n if colorMMode == nil then\n colorMMode = 1\n end\n\n\n if single then\n centerPoint = screenWidth/2\n bhtml = bhtml..[[Tier ]]..ore.tier..[[]]\n else\n bhtml = bhtml..[[Tier ]]..ore.tier..[[]]\n end\n end\n\n if not screenObject.settings.verticalView then\n startingY = startingY - 10\n end\n\n\n if screenObject.settings.generatebackground and not single then\n screenObject.tiers[ore.tier] = {x1 = centerPoint - (barWidth* 1.3), x2 = centerPoint + (barWidth* 1.3), y1 = startingY - 5}\n if ore.tier > 1 and screenObject.tiers[ore.tier-1] ~= nill then\n screenObject.tiers[ore.tier-1] = {x1 = screenObject.tiers[ore.tier-1].x1 , x2 = screenObject.tiers[ore.tier-1].x2, y1 = screenObject.tiers[ore.tier-1].y1, y2 = lowestY}\n end\n end\n\n tier = ore.tier\n collumn = collumn + 1\n end\n\n\n if ore.containers ~= nil then\n\n if single then\n centerPoint = screenWidth/2\n end\n\n massOre, maxVol = getMass(ore)\n percentOre = math.ceil((math.ceil((massOre * 1000) - 0.5) / maxVol)*100)\n\n local mainhtml, back = generateLine(startingY, centerPoint, ore, percentOre, massOre, false, false, textOnTop, screenObject, single, tier)\n\n html = html..mainhtml\n\n if screenObject.settings.generatebackground then\n bhtml = bhtml..back\n end\n end\n\n if ore.into.containers ~= nil then\n\n local pure = ore.into\n massPure, maxVol = getMass(pure)\n percentPure = math.ceil(((math.ceil((massPure * 1000) - 0.5) / maxVol)*100))\n\n center = centerPoint+barWidth+10\n if single then\n center = screenWidth/2 + barWidthBig+10\n end\n mainhtml, back = generateLine(startingY,center, pure, percentPure, massPure, false, true, textOnTop, screenObject, single, tier)\n html = html..mainhtml\n\n if screenObject.settings.generatebackground then\n bhtml = bhtml..back\n end\n\n end\n if not screenObject.settings.verticalView then\n startingY = startingY + lineGap\n end\n\n if screenObject.settings.verticalView and single then\n startingY = startingY + (lineGapBig*1.5)\n end\n\n\n line = line + 1\n end\n end\n\n if screenObject.settings.generatebackground and not single then\n if screenObject.tiers[tier] ~= nill then\n screenObject.tiers[tier] = {x1 = screenObject.tiers[tier].x1 , x2 = screenObject.tiers[tier].x2, y1 = screenObject.tiers[tier].y1, y2 = lowestY}\n end\n if screenObject.settings.verticalView then\n\n for id,tiers in ipairs(screenObject.tiers) do\n\n x1 = screenObject.tiers[id].x1-300\n x2 = screenObject.tiers[id].x2-300\n y1 = screenObject.tiers[id].y1+((screenWidth - screenHeight)/2)-(lineGap*2)\n y2 = screenObject.tiers[id].y2+((screenWidth - screenHeight)/2)-lineGap\n\n screenObject.tiers[id] = {x1 = y1, x2 = y2, y1 = x1, y2 = x2}\n end\n\n if screenObject.tiers[0] then\n x1 = screenObject.tiers[0].x1-300\n x2 = screenObject.tiers[0].x2-300\n y1 = screenObject.tiers[0].y1+((screenWidth - screenHeight)/2)\n y2 = screenObject.tiers[0].y2+((screenWidth - screenHeight)/2)\n\n screenObject.tiers[0] = {x1 = y1, x2 = y2, y1 = x1, y2 = x2}\n end\n end\n end\n\n html = html..[[]]\n\n\n if screenObject.settings.generatebackground then\n\n updateStyle(screenObject)\n\n bhtml = screenObject.iconStyle..[[]]..bhtml..[[]]\n\n bhtml = bhtml..[[]]\n local y = (screenObject.barColorMode.y+(screenObject.barColorMode.size*0.25))\n\n\n if screenObject.settings.renderSettings then\n\n bhtml = bhtml..[[]]\n\n local colormode = screenObject.settings.tierSettings[screenObject.showTier].barColorMode\n if colormode== nill then\n colormode = 1\n end\n\n bhtml = bhtml..optionColorButton(colormode, barGraphColor(0, false, colormode), barGraphColor(100, false, colormode), screenObject.barColorMode, y)\n\n local bcolormode = screenObject.settings.tierSettings[screenObject.showTier].barBColorMode\n if bcolormode ~= nill then\n colormode = bcolormode\n bcolormode = pbarBackgroundColors[bcolormode]\n end\n if bcolormode == nill then\n colormode = 1\n bcolormode = pbarBackgroundColors[1]\n end\n\n bhtml = bhtml..optionColorButton(colormode, bcolormode.color, bcolormode.border, screenObject.barBColorMode, y)\n\n local bcolormode = screenObject.settings.tierSettings[screenObject.showTier].barTColorMode\n if bcolormode ~= nill then\n colormode = bcolormode\n bcolormode = pbarTextColors[bcolormode]\n end\n if bcolormode == nill then\n colormode = 1\n bcolormode = pbarTextColors[1]\n end\n\n bhtml = bhtml..optionColorButton(colormode, bcolormode.color, bcolormode.border, screenObject.barTColorMode, y)\n\n local mcolormode = screenObject.settings.tierSettings[screenObject.showTier].barMColorMode\n if mcolormode ~= nill then\n colormode = mcolormode\n mcolormode = pbarTextColors[mcolormode]\n end\n if mcolormode == nill then\n colormode = 1\n mcolormode = pbarTextColors[1]\n end\n\n bhtml = bhtml..optionColorButton(colormode, mcolormode.color, mcolormode.border, screenObject.barMColorMode, y)\n\n local bmode = screenObject.settings.tierSettings[screenObject.showTier].background\n if bmode ~= nill then\n colormode = bmode\n bmode = background[bmode]\n end\n if bmode == nill then\n colormode = 1\n bmode = background[1]\n end\n\n bhtml = bhtml..optionColorButton(colormode, bmode.color, bmode.color, screenObject.background, y)\n bhtml = bhtml..optionColorButton(\"Reset\", \"ff0000\", \"ff0000\", screenObject.resetButton, y)\n bhtml = bhtml..optionColorButton(\"+\", \"9A947C\", nill, screenObject.applyToAll, y)\n bhtml = bhtml..[[]]\n bhtml = bhtml..optionColorButton(\"R\", \"9A947C\", nill, screenObject.button, y)\n\n else\n bhtml = bhtml..[[]]\n end\n\n bhtml = bhtml..[[>]]\n\n\n if screenObject.backgroundContentId == nill then\n screenObject.backgroundContentId = screenObject.screen.addContent(0, 0, bhtml)\n else\n screenObject.screen.resetContent(screenObject.backgroundContentId, bhtml)\n end\n screenObject.settings.generatebackground = false\n end\n\n\n if screenObject.oreContentId == nill then\n screenObject.oreContentId = screenObject.screen.addContent(0, 0, html)\n else\n screenObject.screen.resetContent(screenObject.oreContentId, html)\n end\n\n\n\n thtml = [[]]\n\n if counter % 2 == 0 then\n thtml = thtml..[[]]\n else\n thtml = thtml..[[]]\n end\n\n thtml = thtml..[[]]\n\n if screenObject.tickContentId == nill then\n screenObject.tickContentId = screenObject.screen.addContent(0, 0, thtml)\n else\n screenObject.screen.resetContent(screenObject.tickContentId, thtml)\n end\n\n end\nend\nfor _,screenObject in ipairs(screens) do\n screenObject.screen.clear()\nend\ngenerateHtml()\nunit.setTimer('updateTable', 1)\n\n\n\n","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"9"}],"methods":[],"events":[]}