Organizing files

Adding new colors
This commit is contained in:
Gabriel Moreira Minossi 2020-12-20 00:24:39 -03:00
parent d9a5f7fd40
commit b795950cca
34 changed files with 249 additions and 251 deletions

37
Config/colors.lua Normal file
View File

@ -0,0 +1,37 @@
local colors = {
red = 0xFF0000,
lime = 0x00FF00,
blue = 0x0000FF,
magenta = 0xFF00FF,
yellow = 0xFFFF00,
cyan = 0x00FFFF,
green = 0x008000,
purple = 0x800080,
brown = 0xA52A2A,
steelBlue = 0x4682B4,
chocolate = 0xD2691E,
lightGray = 0xD3D3D3,
darkGray = 0xA9A9A9,
rosyBrown = 0xBC8F8F,
white = 0xFFFFFF,
black = 0x000000,
darkSlateGrey = 0x2F4F4F,
machineBackground = colors.darkGray,
progressBackground = colors.lightGray,
labelColor = colors.chocolate,
errorColor = colors.red,
idleColor = colors.purple,
workingColor = colors.steelBlue,
positiveEUColor = colors.lime,
negativeEUColor = colors.brown,
timeColor = colors.purple,
textColor = colors.black,
hudColor = colors.darkSlateGrey,
mainColor = colors.rosyBrown,
background = colors.black,
accentA = colors.cyan,
accentB = colors.magenta,
barColor = colors.blue
}
return colors

View File

@ -1,4 +1,4 @@
local adresses = { local addresses = {
laserEngraver1 = "d9a13648-977b-464e-a228-46bf12e38525", laserEngraver1 = "d9a13648-977b-464e-a228-46bf12e38525",
laserEngraver2 = "a4fd6874-f4a9-40d9-a47b-f88c3ef7d0fa", laserEngraver2 = "a4fd6874-f4a9-40d9-a47b-f88c3ef7d0fa",
laserEngraver3 = "843022a0-5687-49d9-b94c-6637ae8a8ec9", laserEngraver3 = "843022a0-5687-49d9-b94c-6637ae8a8ec9",
@ -10,4 +10,4 @@ local adresses = {
cleanroom = "753f5619-7076-45c0-8f0a-f3899bae00e1" cleanroom = "753f5619-7076-45c0-8f0a-f3899bae00e1"
} }
return adresses return addresses

View File

@ -5,7 +5,7 @@ event = require("event")
thread = require("thread") thread = require("thread")
get = require("easy") get = require("easy")
ARG = require("ARGraphics") ARG = require("ARGraphics")
config = require("config") colors = require("colors")
local ARWidgets = {} local ARWidgets = {}
local firstRead, lastRead, counter, currentIO = 0, 0, 1, 1 local firstRead, lastRead, counter, currentIO = 0, 0, 1, 1
@ -36,20 +36,20 @@ function ARWidgets.powerDisplay(glasses, data, x, y, w, h)
maxEU = math.floor(string.gsub(data.getSensorInformation()[3], "([^0-9]+)", "") + 0) maxEU = math.floor(string.gsub(data.getSensorInformation()[3], "([^0-9]+)", "") + 0)
percentage = currentEU / maxEU percentage = currentEU / maxEU
if initializePowerDisplay then if initializePowerDisplay then
ARG.hudRectangle(glasses, x, y, w, h, hudColor) ARG.hudRectangle(glasses, x, y, w, h, colors.hudColor)
ARG.hudRectangle(glasses, x, y + h, w, 12, hudColor, 0.6) ARG.hudRectangle(glasses, x, y + h, w, 12, colors.hudColor, 0.6)
ARG.hudTriangle(glasses, {x + 2, y + 3}, {x + 2, y + 3 + h - 6}, {x + 2 + h - 6, y + 3 + h - 6}, hudColor) ARG.hudTriangle(glasses, {x + 2, y + 3}, {x + 2, y + 3 + h - 6}, {x + 2 + h - 6, y + 3 + h - 6}, colors.hudColor)
ARG.hudTriangle( ARG.hudTriangle(
glasses, glasses,
{x + 2 + w - 4, y + 3}, {x + 2 + w - 4, y + 3},
{x + 2 + w - 4 - (h - 6), y + 3}, {x + 2 + w - 4 - (h - 6), y + 3},
{x + 2 + w - 4, y + 3 + h - 6}, {x + 2 + w - 4, y + 3 + h - 6},
hudColor colors.hudColor
) )
ARG.hudRectangle(glasses, x, y + h, 25, 12, hudColor) ARG.hudRectangle(glasses, x, y + h, 25, 12, colors.hudColor)
ARG.hudTriangle(glasses, {x + 25, y + h}, {x + 25, y + h + 12}, {x + 37, y + h + 12}, hudColor) ARG.hudTriangle(glasses, {x + 25, y + h}, {x + 25, y + h + 12}, {x + 37, y + h + 12}, colors.hudColor)
ARG.hudRectangle(glasses, x + w - 25, y + h, 25, 12, hudColor) ARG.hudRectangle(glasses, x + w - 25, y + h, 25, 12, colors.hudColor)
ARG.hudTriangle(glasses, {x + w - 37, y + h}, {x + w - 25, y + h + 12}, {x + w - 25, y + h}, hudColor) ARG.hudTriangle(glasses, {x + w - 37, y + h}, {x + w - 25, y + h + 12}, {x + w - 25, y + h}, colors.hudColor)
powerFill = powerFill =
ARG.hudQuad( ARG.hudQuad(
glasses, glasses,
@ -57,7 +57,7 @@ function ARWidgets.powerDisplay(glasses, data, x, y, w, h)
{x + 2 + h - 6, y + 3 + h - 6}, {x + 2 + h - 6, y + 3 + h - 6},
{math.min(x + 2 + w - 5, (w - 4) * percentage), y + 3 + (h - 6)}, {math.min(x + 2 + w - 5, (w - 4) * percentage), y + 3 + (h - 6)},
{math.min(x + 2 + w - 5 - (h - 6), (w - 4) * percentage - (h - 6)), y + 3}, {math.min(x + 2 + w - 5 - (h - 6), (w - 4) * percentage - (h - 6)), y + 3},
workingColor colors.workingColor
) )
powerEmpty = powerEmpty =
ARG.hudQuad( ARG.hudQuad(
@ -66,14 +66,14 @@ function ARWidgets.powerDisplay(glasses, data, x, y, w, h)
{math.min(x + 2 + w - 5, (w - 4) * percentage), y + 3 + (h - 6)}, {math.min(x + 2 + w - 5, (w - 4) * percentage), y + 3 + (h - 6)},
{x + 2 + w - 5, y + 3 + h - 6}, {x + 2 + w - 5, y + 3 + h - 6},
{x + 2 + w - 5 - (h - 6), y + 3}, {x + 2 + w - 5 - (h - 6), y + 3},
machineBackground colors.machineBackground
) )
maxEnergyObj = ARG.hudText(glasses, "", x + w - 88, y - 8, idleColor) maxEnergyObj = ARG.hudText(glasses, "", x + w - 88, y - 8, colors.idleColor)
currentEnergyObj = ARG.hudText(glasses, "", x + 2, y - 8, workingColor) currentEnergyObj = ARG.hudText(glasses, "", x + 2, y - 8, colors.workingColor)
currentFillrateObj = ARG.hudText(glasses, "", x + w / 2 - 20, y + h + 1, 0xFFFFFF) currentFillrateObj = ARG.hudText(glasses, "", x + w / 2 - 20, y + h + 1, 0xFFFFFF)
percentageObj = ARG.hudText(glasses, "", x + w / 2 - 5, y - 8, labelColor) percentageObj = ARG.hudText(glasses, "", x + w / 2 - 5, y - 8, colors.labelColor)
timeObj = ARG.hudText(glasses, "", x + 35, y + h + 1, labelColor) timeObj = ARG.hudText(glasses, "", x + 35, y + h + 1, colors.labelColor)
initializePowerDisplay = false initializePowerDisplay = false
end end
if currentIO >= 0 then if currentIO >= 0 then
@ -114,53 +114,53 @@ function ARWidgets.powerDisplay(glasses, data, x, y, w, h)
end end
function ARWidgets.minimapOverlay(glasses) function ARWidgets.minimapOverlay(glasses)
--Minimap Borders --Minimap Borders
ARG.hudRectangle(glasses, 728, 10, 123, 3, hudColor) ARG.hudRectangle(glasses, 728, 10, 123, 3, colors.hudColor)
ARG.hudRectangle(glasses, 728, 130, 123, 3, hudColor) ARG.hudRectangle(glasses, 728, 130, 123, 3, colors.hudColor)
ARG.hudRectangle(glasses, 728, 10, 3, 123, hudColor) ARG.hudRectangle(glasses, 728, 10, 3, 123, colors.hudColor)
ARG.hudRectangle(glasses, 848, 10, 3, 123, hudColor) ARG.hudRectangle(glasses, 848, 10, 3, 123, colors.hudColor)
--Coordinate Borders --Coordinate Borders
ARG.hudTriangle(glasses, {743, 133}, {728, 133}, {743, 143}, hudColor) ARG.hudTriangle(glasses, {743, 133}, {728, 133}, {743, 143}, colors.hudColor)
ARG.hudRectangle(glasses, 743, 133, 8, 10, hudColor) ARG.hudRectangle(glasses, 743, 133, 8, 10, colors.hudColor)
ARG.hudRectangle(glasses, 751, 140, 170, 3, hudColor) ARG.hudRectangle(glasses, 751, 140, 170, 3, colors.hudColor)
--Biome Borders --Biome Borders
ARG.hudTriangle(glasses, {768, 143}, {753, 143}, {768, 153}, hudColor) ARG.hudTriangle(glasses, {768, 143}, {753, 143}, {768, 153}, colors.hudColor)
ARG.hudRectangle(glasses, 768, 150, 170, 3, hudColor) ARG.hudRectangle(glasses, 768, 150, 170, 3, colors.hudColor)
ARG.hudRectangle(glasses, 829, 133, 50, 7, 0, 0.8) ARG.hudRectangle(glasses, 829, 133, 50, 7, 0, 0.8)
ARG.hudRectangle(glasses, 811, 143, 50, 7, 0, 0.8) ARG.hudRectangle(glasses, 811, 143, 50, 7, 0, 0.8)
--FPS Borders --FPS Borders
ARG.hudRectangle(glasses, 728, 0, 150, 2, hudColor) ARG.hudRectangle(glasses, 728, 0, 150, 2, colors.hudColor)
ARG.hudRectangle(glasses, 728, 0, 22, 12, hudColor) ARG.hudRectangle(glasses, 728, 0, 22, 12, colors.hudColor)
ARG.hudRectangle(glasses, 750, 2, 28, 8, 0, 0.8) ARG.hudRectangle(glasses, 750, 2, 28, 8, 0, 0.8)
ARG.hudTriangle(glasses, {758, 2}, {750, 2}, {750, 10}, hudColor) ARG.hudTriangle(glasses, {758, 2}, {750, 2}, {750, 10}, colors.hudColor)
ARG.hudRectangle(glasses, 801, 2, 70, 8, 0, 0.8) ARG.hudRectangle(glasses, 801, 2, 70, 8, 0, 0.8)
ARG.hudRectangle(glasses, 851, 10, 5, 123, 0, 0.8) ARG.hudRectangle(glasses, 851, 10, 5, 123, 0, 0.8)
end end
function ARWidgets.hudOverlayBase(glasses, x, y) function ARWidgets.hudOverlayBase(glasses, x, y)
local hotbarSplitter = ARG.hudRectangle(glasses, x, y, 183, 2, hudColor) local hotbarSplitter = ARG.hudRectangle(glasses, x, y, 183, 2, colors.hudColor)
local expSplitter = ARG.hudRectangle(glasses, x, y - 6, 183, 2, hudColor) local expSplitter = ARG.hudRectangle(glasses, x, y - 6, 183, 2, colors.hudColor)
local expOverlay = ARG.hudRectangle(glasses, x, y - 4, 183, 4, workingColor, 0.5) local expOverlay = ARG.hudRectangle(glasses, x, y - 4, 183, 4, colors.workingColor, 0.5)
local leftBorder = ARG.hudRectangle(glasses, x - 1, y - 13, 3, 38, hudColor) local leftBorder = ARG.hudRectangle(glasses, x - 1, y - 13, 3, 38, colors.hudColor)
local rightBorder = ARG.hudRectangle(glasses, x + 182, y - 5, 3, 30, hudColor) local rightBorder = ARG.hudRectangle(glasses, x + 182, y - 5, 3, 30, colors.hudColor)
local armorBox = ARG.hudRectangle(glasses, x, y - 27, 90, 15, hudColor, 0.0) local armorBox = ARG.hudRectangle(glasses, x, y - 27, 90, 15, colors.hudColor, 0.0)
local hpBox = ARG.hudRectangle(glasses, x + 1, y - 15, 94, 10, hudColor, 0.7) local hpBox = ARG.hudRectangle(glasses, x + 1, y - 15, 94, 10, colors.hudColor, 0.7)
local hpStopper = local hpStopper =
ARG.hudQuad(glasses, {x + 88, y - 16}, {x + 77, y - 5}, {x + 108, y - 5}, {x + 97, y - 16}, hudColor) ARG.hudQuad(glasses, {x + 88, y - 16}, {x + 77, y - 5}, {x + 108, y - 5}, {x + 97, y - 16}, colors.hudColor)
local topBorder = ARG.hudRectangle(glasses, x + 4, y - 18, 178, 3, hudColor) local topBorder = ARG.hudRectangle(glasses, x + 4, y - 18, 178, 3, colors.hudColor)
local topWedge = ARG.hudTriangle(glasses, {x + 4, y - 18}, {x - 1, y - 13}, {x + 4, y - 13}, hudColor) local topWedge = ARG.hudTriangle(glasses, {x + 4, y - 18}, {x - 1, y - 13}, {x + 4, y - 13}, colors.hudColor)
local connector = ARG.hudTriangle(glasses, {x + 182, y - 18}, {x + 182, y}, {x + 200, y}, hudColor) local connector = ARG.hudTriangle(glasses, {x + 182, y - 18}, {x + 182, y}, {x + 200, y}, colors.hudColor)
local topStrip = ARG.hudRectangle(glasses, x + 4, y - 17, 178, 1, workingColor) local topStrip = ARG.hudRectangle(glasses, x + 4, y - 17, 178, 1, colors.workingColor)
local expWedge1 = ARG.hudTriangle(glasses, {x + 179, y - 4}, {x + 183, y}, {x + 183, y - 4}, hudColor) local expWedge1 = ARG.hudTriangle(glasses, {x + 179, y - 4}, {x + 183, y}, {x + 183, y - 4}, colors.hudColor)
local expWedge2 = ARG.hudTriangle(glasses, {x + 2, y - 5}, {x + 2, y}, {x + 6, y}, hudColor) local expWedge2 = ARG.hudTriangle(glasses, {x + 2, y - 5}, {x + 2, y}, {x + 6, y}, colors.hudColor)
--CPU Monitor --CPU Monitor
local base = ARG.hudRectangle(glasses, x + 185, y, 28, 24, hudColor) local base = ARG.hudRectangle(glasses, x + 185, y, 28, 24, colors.hudColor)
local cpuStrip = ARG.hudRectangle(glasses, x + 185, y, 500, 3, hudColor) local cpuStrip = ARG.hudRectangle(glasses, x + 185, y, 500, 3, colors.hudColor)
local itemBorder1 = ARG.hudRectangle(glasses, x + 28 + 185, y + 3, 1, 21, workingColor, 0.8) local itemBorder1 = ARG.hudRectangle(glasses, x + 28 + 185, y + 3, 1, 21, colors.workingColor, 0.8)
local itemBorder2 = ARG.hudRectangle(glasses, x + 28 + 185, y + 3, 61, 1, workingColor, 0.8) local itemBorder2 = ARG.hudRectangle(glasses, x + 28 + 185, y + 3, 61, 1, colors.workingColor, 0.8)
local itemBorder3 = ARG.hudRectangle(glasses, x + 88 + 185, y + 3, 1, 21, workingColor, 0.8) local itemBorder3 = ARG.hudRectangle(glasses, x + 88 + 185, y + 3, 1, 21, colors.workingColor, 0.8)
local itemBorder4 = ARG.hudRectangle(glasses, x + 28 + 185, y + 23, 61, 1, workingColor, 0.8) local itemBorder4 = ARG.hudRectangle(glasses, x + 28 + 185, y + 23, 61, 1, colors.workingColor, 0.8)
local cpuBase1 = ARG.hudRectangle(glasses, x + 89 + 185, y, 5, 24, hudColor) local cpuBase1 = ARG.hudRectangle(glasses, x + 89 + 185, y, 5, 24, colors.hudColor)
local connectorStrip = local connectorStrip =
ARG.hudQuad(glasses, {x + 182, y - 17}, {x + 182, y - 16}, {x + 213, y + 15}, {x + 213, y + 14}, workingColor) ARG.hudQuad(glasses, {x + 182, y - 17}, {x + 182, y - 16}, {x + 213, y + 15}, {x + 213, y + 14}, colors.workingColor)
end end
function popupText(glasses, text, x, y, color) function popupText(glasses, text, x, y, color)
local substringLength = 1 local substringLength = 1
@ -169,8 +169,8 @@ function popupText(glasses, text, x, y, color)
local stepLength = substringLength * 5 local stepLength = substringLength * 5
local i = 1 local i = 1
local background = local background =
ARG.hudQuad(glasses, {x - 5, y}, {x - 5, y + 9}, {x - 5 + 1, y + 9}, {x - 5 + 1, y}, machineBackground, 0.5) ARG.hudQuad(glasses, {x - 5, y}, {x - 5, y + 9}, {x - 5 + 1, y + 9}, {x - 5 + 1, y}, colors.machineBackground, 0.5)
local top = ARG.hudQuad(glasses, {x - 5, y - 1}, {x - 5, y}, {x - 5 + 1, y}, {x - 5 + 1, y - 1}, machineBackground) local top = ARG.hudQuad(glasses, {x - 5, y - 1}, {x - 5, y}, {x - 5 + 1, y}, {x - 5 + 1, y - 1}, colors.machineBackground)
local bottom = local bottom =
ARG.hudQuad( ARG.hudQuad(
glasses, glasses,
@ -178,7 +178,7 @@ function popupText(glasses, text, x, y, color)
{x - 5, y + 10}, {x - 5, y + 10},
{x - 5 + 1, y + 10}, {x - 5 + 1, y + 10},
{x - 5 + 1, y + 9}, {x - 5 + 1, y + 9},
machineBackground colors.machineBackground
) )
local hudText = ARG.hudText(glasses, "", x + 1, y + 1, color) local hudText = ARG.hudText(glasses, "", x + 1, y + 1, color)
local wedge = local wedge =
@ -188,7 +188,7 @@ function popupText(glasses, text, x, y, color)
{x - 5, y - 1}, {x - 5, y - 1},
{x - 5, y + 10}, {x - 5, y + 10},
{x - 5 + 11, y + 10}, {x - 5 + 11, y + 10},
machineBackground colors.machineBackground
) )
local direction = 1 local direction = 1
local function advance() local function advance()
@ -236,7 +236,7 @@ function ARWidgets.fluidMonitor(glasses, x, y, fluidMap)
{x - 8, y + 8 + i * h}, {x - 8, y + 8 + i * h},
{x + w, y + 8 + i * h}, {x + w, y + 8 + i * h},
{x + w, y + i * h}, {x + w, y + i * h},
hudColor, colors.hudColor,
0.5 0.5
) )
local top = local top =
@ -246,7 +246,7 @@ function ARWidgets.fluidMonitor(glasses, x, y, fluidMap)
{x - 10, y + i * h}, {x - 10, y + i * h},
{x + w, y + i * h}, {x + w, y + i * h},
{x + w, y - 1 + i * h}, {x + w, y - 1 + i * h},
hudColor colors.hudColor
) )
local bottom = local bottom =
ARG.hudQuad( ARG.hudQuad(
@ -255,7 +255,7 @@ function ARWidgets.fluidMonitor(glasses, x, y, fluidMap)
{x - 8, y + 9 + i * h}, {x - 8, y + 9 + i * h},
{x + w, y + 9 + i * h}, {x + w, y + 9 + i * h},
{x + w, y + 8 + i * h}, {x + w, y + 8 + i * h},
hudColor colors.hudColor
) )
local fill = local fill =
ARG.hudQuad( ARG.hudQuad(
@ -278,7 +278,7 @@ function ARWidgets.fluidMonitor(glasses, x, y, fluidMap)
{x - 10, y + 9 + i * h}, {x - 10, y + 9 + i * h},
{x - 6, y + 9 + i * h}, {x - 6, y + 9 + i * h},
{x + 3, y + i * h}, {x + 3, y + i * h},
hudColor colors.hudColor
) )
else else
local wedge = local wedge =
@ -288,7 +288,7 @@ function ARWidgets.fluidMonitor(glasses, x, y, fluidMap)
{x - 10, y + 9 + i * h}, {x - 10, y + 9 + i * h},
{x + 3, y + 9 + i * h}, {x + 3, y + 9 + i * h},
{x - 6, y + i * h}, {x - 6, y + i * h},
hudColor colors.hudColor
) )
end end
entries = i entries = i
@ -301,7 +301,7 @@ function ARWidgets.fluidMonitor(glasses, x, y, fluidMap)
{x - 2, y + 8 + entries * h}, {x - 2, y + 8 + entries * h},
{x + w, y + 8 + entries * h}, {x + w, y + 8 + entries * h},
{x + w, y + entries * h}, {x + w, y + entries * h},
hudColor colors.hudColor
) )
local verticalStrip = local verticalStrip =
ARG.hudQuad( ARG.hudQuad(
@ -310,7 +310,7 @@ function ARWidgets.fluidMonitor(glasses, x, y, fluidMap)
{x - 8, y - 2 + entries * h}, {x - 8, y - 2 + entries * h},
{x - 7, y - 2 + entries * h}, {x - 7, y - 2 + entries * h},
{x - 7, y}, {x - 7, y},
workingColor colors.workingColor
) )
local diagonalStrip = local diagonalStrip =
ARG.hudQuad( ARG.hudQuad(
@ -319,7 +319,7 @@ function ARWidgets.fluidMonitor(glasses, x, y, fluidMap)
{x, y + 6 + entries * h}, {x, y + 6 + entries * h},
{x, y + 5 + entries * h}, {x, y + 5 + entries * h},
{x - 7, y - 2 + entries * h}, {x - 7, y - 2 + entries * h},
workingColor colors.workingColor
) )
local horizontalStrip = local horizontalStrip =
ARG.hudQuad( ARG.hudQuad(
@ -328,7 +328,7 @@ function ARWidgets.fluidMonitor(glasses, x, y, fluidMap)
{x, y + 6 + entries * h}, {x, y + 6 + entries * h},
{x + w, y + 6 + entries * h}, {x + w, y + 6 + entries * h},
{x + w, y + 5 + entries * h}, {x + w, y + 5 + entries * h},
workingColor colors.workingColor
) )
initFluidMap = false initFluidMap = false
elseif computer.uptime() - lastRefresh > 30 then elseif computer.uptime() - lastRefresh > 30 then
@ -364,11 +364,11 @@ local rollingTextObjects = {}
local function rollingText(glasses, text, start, stop, y, color) local function rollingText(glasses, text, start, stop, y, color)
local textObject = ARG.hudText(glasses, "", start, y, color) local textObject = ARG.hudText(glasses, "", start, y, color)
textObject.setAlpha(0.8) textObject.setAlpha(0.8)
local backgroundEndWedge = ARG.hudTriangle(glasses, {stop, y - 2}, {stop, y + 10}, {stop + 12, y + 10}, hudColor) local backgroundEndWedge = ARG.hudTriangle(glasses, {stop, y - 2}, {stop, y + 10}, {stop + 12, y + 10}, colors.hudColor)
local backgroundStartWedge = local backgroundStartWedge =
ARG.hudTriangle(glasses, {start - 12, y - 2}, {start, y + 10}, {start + 12, y - 2}, hudColor) ARG.hudTriangle(glasses, {start - 12, y - 2}, {start, y + 10}, {start + 12, y - 2}, colors.hudColor)
local startWedge = local startWedge =
ARG.hudQuad(glasses, {start, y - 2}, {start, y + 8}, {start + 30, y + 8}, {start + 30, y - 2}, hudColor) ARG.hudQuad(glasses, {start, y - 2}, {start, y + 8}, {start + 30, y + 8}, {start + 30, y - 2}, colors.hudColor)
rollingTextObjects[#rollingTextObjects + 1] = { rollingTextObjects[#rollingTextObjects + 1] = {
t = textObject, t = textObject,
bew = backgroundEndWedge, bew = backgroundEndWedge,
@ -459,27 +459,27 @@ function ARWidgets.itemTicker(glasses, x, y, w)
end end
if initializeTicker then if initializeTicker then
local background = local background =
ARG.hudQuad(glasses, {x, y + 2}, {x, y + 14}, {x + w, y + 14}, {x + w, y + 2}, machineBackground, 0.5) ARG.hudQuad(glasses, {x, y + 2}, {x, y + 14}, {x + w, y + 14}, {x + w, y + 2}, colors.machineBackground, 0.5)
local top = ARG.hudQuad(glasses, {x, y}, {x, y + 2}, {x + w, y + 2}, {x + w, y}, hudColor) local top = ARG.hudQuad(glasses, {x, y}, {x, y + 2}, {x + w, y + 2}, {x + w, y}, colors.hudColor)
local bottom = ARG.hudQuad(glasses, {x, y + 14}, {x, y + 20}, {x + w, y + 20}, {x + w, y + 14}, hudColor) local bottom = ARG.hudQuad(glasses, {x, y + 14}, {x, y + 20}, {x + w, y + 20}, {x + w, y + 14}, colors.hudColor)
local bottomStripe = local bottomStripe =
ARG.hudQuad(glasses, {x, y + 17}, {x, y + 18}, {x + w, y + 18}, {x + w, y + 17}, workingColor) ARG.hudQuad(glasses, {x, y + 17}, {x, y + 18}, {x + w, y + 18}, {x + w, y + 17}, colors.workingColor)
local wedge = ARG.hudTriangle(glasses, {x - 20, y}, {x, y + 20}, {x, y}, hudColor) local wedge = ARG.hudTriangle(glasses, {x - 20, y}, {x, y + 20}, {x, y}, colors.hudColor)
local backgroundEndWedge = ARG.hudTriangle(glasses, {x, y + 2}, {x, y + 14}, {x + 12, y + 14}, hudColor) local backgroundEndWedge = ARG.hudTriangle(glasses, {x, y + 2}, {x, y + 14}, {x + 12, y + 14}, colors.hudColor)
local backgroundStartWedge = local backgroundStartWedge =
ARG.hudTriangle(glasses, {x + w - 12, y + 2}, {x + w, y + 14}, {x + w + 12, y + 2}, hudColor) ARG.hudTriangle(glasses, {x + w - 12, y + 2}, {x + w, y + 14}, {x + w + 12, y + 2}, colors.hudColor)
local diagonalStripe = local diagonalStripe =
ARG.hudQuad(glasses, {x - 16, y + 2}, {x, y + 18}, {x, y + 17}, {x - 15, y + 2}, workingColor) ARG.hudQuad(glasses, {x - 16, y + 2}, {x, y + 18}, {x, y + 17}, {x - 15, y + 2}, colors.workingColor)
local bottomBorder = ARG.hudRectangle(glasses, x + w - 170, y + 28, 170, 4, hudColor) local bottomBorder = ARG.hudRectangle(glasses, x + w - 170, y + 28, 170, 4, colors.hudColor)
local dataBorder = ARG.hudRectangle(glasses, x + w - 170, 20, 170, 12, hudColor, 0.5) local dataBorder = ARG.hudRectangle(glasses, x + w - 170, 20, 170, 12, colors.hudColor, 0.5)
local endWedge = local endWedge =
ARG.hudTriangle(glasses, {x + w - 182, y + 20}, {x + w - 170, y + 32}, {x + w - 170, y + 20}, hudColor) ARG.hudTriangle(glasses, {x + w - 182, y + 20}, {x + w - 170, y + 32}, {x + w - 170, y + 20}, colors.hudColor)
local divisor1 = ARG.hudRectangle(glasses, x + w - 118, y + 20, 2, 12, hudColor) local divisor1 = ARG.hudRectangle(glasses, x + w - 118, y + 20, 2, 12, colors.hudColor)
local divisor2 = ARG.hudRectangle(glasses, x + w - 64, y + 20, 2, 12, hudColor) local divisor2 = ARG.hudRectangle(glasses, x + w - 64, y + 20, 2, 12, colors.hudColor)
local bottomDataStripe = ARG.hudRectangle(glasses, x + w - 168, y + 30, 168, 1, workingColor) local bottomDataStripe = ARG.hudRectangle(glasses, x + w - 168, y + 30, 168, 1, colors.workingColor)
uniqueItems = ARG.hudText(glasses, "", x, y, workingColor, 0.75) uniqueItems = ARG.hudText(glasses, "", x, y, colors.workingColor, 0.75)
totalItems = ARG.hudText(glasses, "", x, y, workingColor, 0.75) totalItems = ARG.hudText(glasses, "", x, y, colors.workingColor, 0.75)
patterns = ARG.hudText(glasses, "", x, y, workingColor, 0.75) patterns = ARG.hudText(glasses, "", x, y, colors.workingColor, 0.75)
uniqueItems.setPosition((x + w - 114) * 1.33333, (y + 22) * 1.33333) uniqueItems.setPosition((x + w - 114) * 1.33333, (y + 22) * 1.33333)
totalItems.setPosition((x + w - 168) * 1.33333, (y + 22) * 1.33333) totalItems.setPosition((x + w - 168) * 1.33333, (y + 22) * 1.33333)
patterns.setPosition((x + w - 60) * 1.33333, (y + 22) * 1.33333) patterns.setPosition((x + w - 60) * 1.33333, (y + 22) * 1.33333)
@ -489,9 +489,9 @@ function ARWidgets.itemTicker(glasses, x, y, w)
rollingText(glasses, name, x + w, x, y + 4, 0xAAAAAA) rollingText(glasses, name, x + w, x, y + 4, 0xAAAAAA)
local function showChange() local function showChange()
if amount > 0 then if amount > 0 then
rollingText(glasses, "+" .. amount, x + w, x, y + 4, positiveEUColor) rollingText(glasses, "+" .. amount, x + w, x, y + 4, colors.positiveEUColor)
else else
rollingText(glasses, "" .. amount, x + w, x, y + 4, negativeEUColor) rollingText(glasses, "" .. amount, x + w, x, y + 4, colors.negativeEUColor)
end end
end end
event.timer(#name * 0.12, showChange, 1) event.timer(#name * 0.12, showChange, 1)
@ -517,20 +517,20 @@ function ARWidgets.itemTicker(glasses, x, y, w)
end end
end end
function ARWidgets.crossHair(glasses, x, y) function ARWidgets.crossHair(glasses, x, y)
local horizontal = ARG.hudRectangle(glasses, x, y + 5, 4, 1, workingColor, 0.5) local horizontal = ARG.hudRectangle(glasses, x, y + 5, 4, 1, colors.workingColor, 0.5)
local vertical = ARG.hudRectangle(glasses, x + 5, y, 1, 4, workingColor, 0.5) local vertical = ARG.hudRectangle(glasses, x + 5, y, 1, 4, colors.workingColor, 0.5)
local horizontal2 = ARG.hudRectangle(glasses, x + 7, y + 5, 4, 1, workingColor, 0.5) local horizontal2 = ARG.hudRectangle(glasses, x + 7, y + 5, 4, 1, colors.workingColor, 0.5)
local vertical2 = ARG.hudRectangle(glasses, x + 5, y + 7, 1, 4, workingColor, 0.5) local vertical2 = ARG.hudRectangle(glasses, x + 5, y + 7, 1, 4, colors.workingColor, 0.5)
local middle = ARG.hudRectangle(glasses, x + 4, y + 4, 3, 3, hudColor, 0.0) local middle = ARG.hudRectangle(glasses, x + 4, y + 4, 3, 3, colors.hudColor, 0.0)
local center = ARG.hudRectangle(glasses, x + 5, y + 5, 1, 1, hudColor, 0.7) local center = ARG.hudRectangle(glasses, x + 5, y + 5, 1, 1, colors.hudColor, 0.7)
end end
local initializeCpuMonitor = true local initializeCpuMonitor = true
local cpuLights = {} local cpuLights = {}
function ARWidgets.cpuMonitor(glasses, x, y) function ARWidgets.cpuMonitor(glasses, x, y)
if initializeCpuMonitor then if initializeCpuMonitor then
local cpuBase2 = ARG.hudRectangle(glasses, x + 94, y + 12, 8, 12, hudColor) local cpuBase2 = ARG.hudRectangle(glasses, x + 94, y + 12, 8, 12, colors.hudColor)
local cpuSplitter = ARG.hudRectangle(glasses, x + 89, y + 9, 400, 3, hudColor) local cpuSplitter = ARG.hudRectangle(glasses, x + 89, y + 9, 400, 3, colors.hudColor)
local cpuSplitter2 = ARG.hudRectangle(glasses, x + 102, y + 18, 380, 6, hudColor) local cpuSplitter2 = ARG.hudRectangle(glasses, x + 102, y + 18, 380, 6, colors.hudColor)
local function createCpuIndicator(cpuX, cpuY) local function createCpuIndicator(cpuX, cpuY)
local status = local status =
ARG.hudQuad( ARG.hudQuad(
@ -539,11 +539,11 @@ function ARWidgets.cpuMonitor(glasses, x, y)
{cpuX + 6, cpuY + 6}, {cpuX + 6, cpuY + 6},
{cpuX + 16, cpuY + 6}, {cpuX + 16, cpuY + 6},
{cpuX + 10, cpuY}, {cpuX + 10, cpuY},
hudColor, colors.hudColor,
1.0 1.0
) )
local leftTriangle = local leftTriangle =
ARG.hudTriangle(glasses, {cpuX, cpuY}, {cpuX, cpuY + 6}, {cpuX + 6, cpuY + 6}, hudColor) ARG.hudTriangle(glasses, {cpuX, cpuY}, {cpuX, cpuY + 6}, {cpuX + 6, cpuY + 6}, colors.hudColor)
local rightTriangle = local rightTriangle =
ARG.hudQuad( ARG.hudQuad(
glasses, glasses,
@ -551,7 +551,7 @@ function ARWidgets.cpuMonitor(glasses, x, y)
{cpuX + 16, cpuY + 6}, {cpuX + 16, cpuY + 6},
{cpuX + 18, cpuY + 6}, {cpuX + 18, cpuY + 6},
{cpuX + 18, cpuY}, {cpuX + 18, cpuY},
hudColor colors.hudColor
) )
return status return status
end end
@ -568,9 +568,9 @@ function ARWidgets.cpuMonitor(glasses, x, y)
end end
cpuNumber = cpuNumber + 1 cpuNumber = cpuNumber + 1
end end
local rowStop1 = ARG.hudRectangle(glasses, x + 94 + i * 17, y + 3, 300, 6, hudColor) local rowStop1 = ARG.hudRectangle(glasses, x + 94 + i * 17, y + 3, 300, 6, colors.hudColor)
local rowStop2 = ARG.hudRectangle(glasses, x + 102 + j * 17, y + 12, 300, 6, hudColor) local rowStop2 = ARG.hudRectangle(glasses, x + 102 + j * 17, y + 12, 300, 6, colors.hudColor)
local horizontalStrip = ARG.hudRectangle(glasses, x + 100, y + 22, 210, 1, workingColor) local horizontalStrip = ARG.hudRectangle(glasses, x + 100, y + 22, 210, 1, colors.workingColor)
local diagonalStrip = local diagonalStrip =
ARG.hudQuad( ARG.hudQuad(
glasses, glasses,
@ -578,17 +578,17 @@ function ARWidgets.cpuMonitor(glasses, x, y)
{x + 89, y + 12}, {x + 89, y + 12},
{x + 100, y + 23}, {x + 100, y + 23},
{x + 100, y + 22}, {x + 100, y + 22},
workingColor colors.workingColor
) )
initializeCpuMonitor = false initializeCpuMonitor = false
end end
local cpus = comp.me_interface.getCpus() local cpus = comp.me_interface.getCpus()
for i = 1, #cpus, 1 do for i = 1, #cpus, 1 do
if cpus[i].busy then if cpus[i].busy then
cpuLights[i].setColor(ARG.hexToRGB(positiveEUColor)) cpuLights[i].setColor(ARG.hexToRGB(colors.positiveEUColor))
else else
cpuLights[i].setAlpha(0.7) cpuLights[i].setAlpha(0.7)
cpuLights[i].setColor(ARG.hexToRGB(workingColor)) cpuLights[i].setColor(ARG.hexToRGB(colors.workingColor))
end end
end end
end end
@ -598,30 +598,30 @@ function ARWidgets.displayTPS(glasses, x, y)
if initializeTPS then if initializeTPS then
initializeTPS = false initializeTPS = false
local background = local background =
ARG.hudQuad(glasses, {x + 40, y + 4}, {x + 40, y + 15}, {x + 93, y + 15}, {x + 105, y + 4}, hudColor, 0.6) ARG.hudQuad(glasses, {x + 40, y + 4}, {x + 40, y + 15}, {x + 93, y + 15}, {x + 105, y + 4}, colors.hudColor, 0.6)
local startBlock = ARG.hudRectangle(glasses, x, y, 40, 23, hudColor) local startBlock = ARG.hudRectangle(glasses, x, y, 40, 23, colors.hudColor)
local top = ARG.hudRectangle(glasses, x + 40, y, 65, 4, hudColor) local top = ARG.hudRectangle(glasses, x + 40, y, 65, 4, colors.hudColor)
local bottom = ARG.hudRectangle(glasses, x + 40, y + 14, 50, 5, hudColor) local bottom = ARG.hudRectangle(glasses, x + 40, y + 14, 50, 5, colors.hudColor)
local wedge1 = local wedge1 =
ARG.hudQuad(glasses, {x + 40, y + 19}, {x + 40, y + 23}, {x + 42, y + 23}, {x + 46, y + 19}, hudColor) ARG.hudQuad(glasses, {x + 40, y + 19}, {x + 40, y + 23}, {x + 42, y + 23}, {x + 46, y + 19}, colors.hudColor)
local wedge2 = ARG.hudQuad(glasses, {x + 105, y}, {x + 86, y + 19}, {x + 93, y + 19}, {x + 112, y}, hudColor) local wedge2 = ARG.hudQuad(glasses, {x + 105, y}, {x + 86, y + 19}, {x + 93, y + 19}, {x + 112, y}, colors.hudColor)
local stripe1 = ARG.hudRectangle(glasses, x + 2, y + 20, 39, 1, workingColor) local stripe1 = ARG.hudRectangle(glasses, x + 2, y + 20, 39, 1, colors.workingColor)
local stripe2 = ARG.hudRectangle(glasses, x + 45, y + 16, 48, 1, workingColor) local stripe2 = ARG.hudRectangle(glasses, x + 45, y + 16, 48, 1, colors.workingColor)
local stripe3 = local stripe3 =
ARG.hudQuad(glasses, {x + 41, y + 20}, {x + 41, y + 21}, {x + 45, y + 17}, {x + 45, y + 16}, workingColor) ARG.hudQuad(glasses, {x + 41, y + 20}, {x + 41, y + 21}, {x + 45, y + 17}, {x + 45, y + 16}, colors.workingColor)
local stripe4 = ARG.hudRectangle(glasses, x + 1, y + 2, 1, 19, workingColor) local stripe4 = ARG.hudRectangle(glasses, x + 1, y + 2, 1, 19, colors.workingColor)
TPSText = ARG.hudText(glasses, "", x + 42, y + 6, workingColor, 1) TPSText = ARG.hudText(glasses, "", x + 42, y + 6, colors.workingColor, 1)
end end
local tps = math.min(20.00, get.tps()) local tps = math.min(20.00, get.tps())
if tps > 15 then if tps > 15 then
TPSText.setText("TPS: " .. string.sub(tps, 1, 5)) TPSText.setText("TPS: " .. string.sub(tps, 1, 5))
TPSText.setColor(ARG.hexToRGB(positiveEUColor)) TPSText.setColor(ARG.hexToRGB(colors.positiveEUColor))
elseif tps >= 10 then elseif tps >= 10 then
TPSText.setText("TPS: " .. string.sub(tps, 1, 5)) TPSText.setText("TPS: " .. string.sub(tps, 1, 5))
TPSText.setColor(ARG.hexToRGB(workingColor)) TPSText.setColor(ARG.hexToRGB(colors.workingColor))
else else
TPSText.setText("TPS: " .. string.sub(tps, 1, 4)) TPSText.setText("TPS: " .. string.sub(tps, 1, 4))
TPSText.setColor(ARG.hexToRGB(negativeEUColor)) TPSText.setColor(ARG.hexToRGB(colors.negativeEUColor))
end end
end end
function ARWidgets.clear() function ARWidgets.clear()

View File

@ -1,16 +1,5 @@
comp = require("component") comp = require("component")
color = { colors = require("colors")
red = 0xFF0000,
green = 0x00FF00,
blue = 0x0000FF,
purple = 0x5500FF,
cyan = 0x00A6FF,
lightGreen = 0x00CC00,
lightGray = 0x272c2e,
darkGray = 0x121010,
white = 0x000000,
black = 0x000000
}
local graphics = {} local graphics = {}
function pixel(GPU, x, y, color) function pixel(GPU, x, y, color)

View File

@ -4,6 +4,7 @@ local thread = require("thread")
local uc = require("unicode") local uc = require("unicode")
local comp = require("component") local comp = require("component")
GPU = comp.proxy(comp.get("f26678f4")) GPU = comp.proxy(comp.get("f26678f4"))
local colors = require("colors")
local gui, quit, editing = {}, false, false local gui, quit, editing = {}, false, false
local currentWindows = {} local currentWindows = {}
@ -36,9 +37,9 @@ function contextMenu(GPU, x, y, data)
end end
local contextWindow = createWindow(GPU, longestData, #data * 2, "ContextMenu" .. contextMenus) local contextWindow = createWindow(GPU, longestData, #data * 2, "ContextMenu" .. contextMenus)
GPU.setActiveBuffer(contextWindow) GPU.setActiveBuffer(contextWindow)
draw.rect(GPU, 1, 1, longestData, #data * 2, color.lightGray) draw.rect(GPU, 1, 1, longestData, #data * 2, colors.lightGray)
for i = 1, #data do for i = 1, #data do
draw.text(GPU, 1, 1 + i * 2 - 2, color.cyan, data[i]) draw.text(GPU, 1, 1 + i * 2 - 2, colors.cyan, data[i])
end end
currentWindows["ContextMenu" .. contextMenus].x = x currentWindows["ContextMenu" .. contextMenus].x = x
currentWindows["ContextMenu" .. contextMenus].y = y currentWindows["ContextMenu" .. contextMenus].y = y
@ -71,13 +72,13 @@ function processCommand(GPU, window, option)
end end
GPU.setActiveBuffer(currentWindows["ColorBox"].page) GPU.setActiveBuffer(currentWindows["ColorBox"].page)
if option == 1 then if option == 1 then
draw.rect(GPU, 1, 1, 10, 10, color.red) draw.rect(GPU, 1, 1, 10, 10, colors.red)
end end
if option == 2 then if option == 2 then
draw.rect(GPU, 1, 1, 10, 10, color.blue) draw.rect(GPU, 1, 1, 10, 10, colors.blue)
end end
if option == 3 then if option == 3 then
draw.rect(GPU, 1, 1, 10, 10, color.green) draw.rect(GPU, 1, 1, 10, 10, colors.green)
end end
GPU.setActiveBuffer(0) GPU.setActiveBuffer(0)
end end
@ -86,7 +87,7 @@ local i, xOffset, yOffset = 1, 0, 0
function mouseListener() function mouseListener()
function processClick(event, address, x, y, key, player) function processClick(event, address, x, y, key, player)
activeWindow = checkCollision(x, y) activeWindow = checkCollision(x, y)
draw.text(GPU, 1, 1, color.cyan, "Active window: " .. activeWindow) draw.text(GPU, 1, 1, colors.cyan, "Active window: " .. activeWindow)
if key == 1.0 and editing then if key == 1.0 and editing then
if inContextMenu then if inContextMenu then
contextMenus = 0 contextMenus = 0

View File

@ -4,20 +4,15 @@ computer = require("computer")
event = require("event") event = require("event")
draw = require("graphics") draw = require("graphics")
util = require("utility") util = require("utility")
colors = require("colors")
local mainColor = color.purple
local background = color.black
local accentA = color.cyan
local accentB = color.red
local barColor = color.blue
local widgets = {} local widgets = {}
function widgets.gtMachineInit(GPU, name, address) function widgets.gtMachineInit(GPU, name, address)
local maintenanceIndex = 0 local maintenanceIndex = 0
local machine = util.machine(address) local machine = util.machine(address)
draw.rect(GPU, 1, 1, 28, 9, background) draw.rect(GPU, 1, 1, 28, 9, colors.background)
draw.text(GPU, 4, 3, mainColor, name) draw.text(GPU, 4, 3, colors.mainColor, name)
if machine ~= nil then if machine ~= nil then
for i = 1, #machine.getSensorInformation() do --Get maintenance index for i = 1, #machine.getSensorInformation() do --Get maintenance index
if string.match(machine.getSensorInformation()[i], "Problems") ~= nil then if string.match(machine.getSensorInformation()[i], "Problems") ~= nil then
@ -29,26 +24,26 @@ function widgets.gtMachineInit(GPU, name, address)
if string.match(machine.getSensorInformation()[6], "tier") ~= nil then if string.match(machine.getSensorInformation()[6], "tier") ~= nil then
local tier = util.tier((string.gsub(machine.getSensorInformation()[6], "([^0-9]+)", "") - 1) / 10) local tier = util.tier((string.gsub(machine.getSensorInformation()[6], "([^0-9]+)", "") - 1) / 10)
if tier ~= nil then if tier ~= nil then
draw.text(GPU, 4, 5, accentB, "" .. tier) draw.text(GPU, 4, 5, colors.accentB, "" .. tier)
end end
end end
--Check for parallel on Processing Arrays --Check for parallel on Processing Arrays
if string.match(machine.getSensorInformation()[7], "Parallel") ~= nil then if string.match(machine.getSensorInformation()[7], "Parallel") ~= nil then
local parallel = string.gsub(machine.getSensorInformation()[7], "([^0-9]+)", "") local parallel = string.gsub(machine.getSensorInformation()[7], "([^0-9]+)", "")
if parallel ~= nil then if parallel ~= nil then
draw.text(GPU, 11 + -(#parallel) .. "", 5, mainColor, parallel .. "x") draw.text(GPU, 11 + -(#parallel) .. "", 5, colors.mainColor, parallel .. "x")
end end
end end
end end
else else
draw.text(GPU, 4, 5, errorColor, "Unknown") draw.text(GPU, 4, 5, colors.errorColor, "Unknown")
end end
draw.rect(GPU, 3, 2, 3, 1, barColor) draw.rect(GPU, 3, 2, 3, 1, colors.barColor)
draw.rect(GPU, 2, 2, 1, 7, barColor) draw.rect(GPU, 2, 2, 1, 7, colors.barColor)
draw.rect(GPU, 3, 8, 20, 1, barColor) draw.rect(GPU, 3, 8, 20, 1, colors.barColor)
draw.rect(GPU, 24, 8, 3, 1, barColor) draw.rect(GPU, 24, 8, 3, 1, colors.barColor)
draw.rect(GPU, 27, 2, 1, 7, barColor) draw.rect(GPU, 27, 2, 1, 7, colors.barColor)
draw.rect(GPU, 7, 2, 21, 1, barColor) draw.rect(GPU, 7, 2, 21, 1, colors.barColor)
return maintenanceIndex return maintenanceIndex
end end
@ -61,50 +56,50 @@ function widgets.gtMachine(GPU, name, address)
local barAmount = currentProgress local barAmount = currentProgress
--First Straight --First Straight
_, f, _ = GPU.get(3, 1) _, f, _ = GPU.get(3, 1)
if f ~= mainColor then if f ~= colors.mainColor then
local bars1 = math.max(0, math.min(3, barAmount)) local bars1 = math.max(0, math.min(3, barAmount))
draw.rect(GPU, 3, 2, 3, 1, barColor) draw.rect(GPU, 3, 2, 3, 1, colors.barColor)
draw.rect(GPU, 24, 8, 3, 1, barColor) draw.rect(GPU, 24, 8, 3, 1, colors.barColor)
draw.rect(GPU, 2, 2, 1, 7, barColor) draw.rect(GPU, 2, 2, 1, 7, colors.barColor)
draw.rect(GPU, 27, 2, 1, 7, barColor) draw.rect(GPU, 27, 2, 1, 7, colors.barColor)
draw.rect(GPU, 3, 8, 20, 1, barColor) draw.rect(GPU, 3, 8, 20, 1, colors.barColor)
draw.rect(GPU, 7, 2, 20, 1, barColor) draw.rect(GPU, 7, 2, 20, 1, colors.barColor)
draw.rect(GPU, 6 - bars1, 2, bars1, 1, mainColor) draw.rect(GPU, 6 - bars1, 2, bars1, 1, colors.mainColor)
draw.rect(GPU, 24, 8, bars1, 1, mainColor) draw.rect(GPU, 24, 8, bars1, 1, colors.mainColor)
end end
_, f, _ = GPU.get(2, 4) _, f, _ = GPU.get(2, 4)
if barAmount > 3 and f ~= mainColor then --Vertical if barAmount > 3 and f ~= colors.mainColor then --Vertical
bars2 = math.max(0, math.min(7, barAmount - 3)) bars2 = math.max(0, math.min(7, barAmount - 3))
draw.rect(GPU, 2, 2, 1, 7, barColor) draw.rect(GPU, 2, 2, 1, 7, colors.barColor)
draw.rect(GPU, 27, 2, 1, 7, barColor) draw.rect(GPU, 27, 2, 1, 7, colors.barColor)
draw.rect(GPU, 3, 8, 20, 1, barColor) draw.rect(GPU, 3, 8, 20, 1, colors.barColor)
draw.rect(GPU, 7, 2, 20, 1, barColor) draw.rect(GPU, 7, 2, 20, 1, colors.barColor)
draw.rect(GPU, 2, 2, 1, bars2, mainColor) draw.rect(GPU, 2, 2, 1, bars2, colors.mainColor)
draw.rect(GPU, 27, 9 - bars2, 1, bars2, mainColor) draw.rect(GPU, 27, 9 - bars2, 1, bars2, colors.mainColor)
end end
if barAmount > 10 then --Long Straight if barAmount > 10 then --Long Straight
local bars3 = math.max(0, barAmount - 10) local bars3 = math.max(0, barAmount - 10)
draw.rect(GPU, 3, 8, 20, 1, barColor) draw.rect(GPU, 3, 8, 20, 1, colors.barColor)
draw.rect(GPU, 7, 2, 20, 1, barColor) draw.rect(GPU, 7, 2, 20, 1, colors.barColor)
draw.rect(GPU, 3, 8, bars3, 1, mainColor) draw.rect(GPU, 3, 8, bars3, 1, colors.mainColor)
draw.rect(GPU, 27 - bars3, 2, bars3, 1, mainColor) draw.rect(GPU, 27 - bars3, 2, bars3, 1, colors.mainColor)
end end
progressString = progressString =
tostring(math.floor(machine.getWorkProgress() / 20)) .. tostring(math.floor(machine.getWorkProgress() / 20)) ..
"/" .. tostring(math.floor(machine.getWorkMaxProgress() / 20)) .. "s" "/" .. tostring(math.floor(machine.getWorkMaxProgress() / 20)) .. "s"
middlePoint = math.min(9, 12 - #progressString / 2) middlePoint = math.min(9, 12 - #progressString / 2)
draw.rect(GPU, 18, 5, 8, 2, background) draw.rect(GPU, 18, 5, 8, 2, colors.background)
draw.text(GPU, 26 - #progressString, 5, accentA, progressString) draw.text(GPU, 26 - #progressString, 5, colors.accentA, progressString)
else --No work else --No work
_, f, _ = GPU.get(5, 1) _, f, _ = GPU.get(5, 1)
if f ~= barColor then if f ~= colors.barColor then
draw.rect(GPU, 18, 5, 8, 2, background) draw.rect(GPU, 18, 5, 8, 2, colors.background)
draw.rect(GPU, 3, 2, 3, 1, barColor) draw.rect(GPU, 3, 2, 3, 1, colors.barColor)
draw.rect(GPU, 2, 2, 1, 7, barColor) draw.rect(GPU, 2, 2, 1, 7, colors.barColor)
draw.rect(GPU, 3, 8, 20, 1, barColor) draw.rect(GPU, 3, 8, 20, 1, colors.barColor)
draw.rect(GPU, 24, 8, 3, 1, barColor) draw.rect(GPU, 24, 8, 3, 1, colors.barColor)
draw.rect(GPU, 27, 2, 1, 7, barColor) draw.rect(GPU, 27, 2, 1, 7, colors.barColor)
draw.rect(GPU, 7, 2, 20, 1, barColor) draw.rect(GPU, 7, 2, 20, 1, colors.barColor)
end end
end end
_, f, _ = GPU.get(6, 1) _, f, _ = GPU.get(6, 1)
@ -112,20 +107,20 @@ function widgets.gtMachine(GPU, name, address)
((windows[name].data == 0 or string.match(machine.getSensorInformation()[windows[name].data], ".*c0.*")) and ((windows[name].data == 0 or string.match(machine.getSensorInformation()[windows[name].data], ".*c0.*")) and
machine.isWorkAllowed()) == true machine.isWorkAllowed()) == true
then then
if f ~= background then if f ~= colors.background then
draw.rect(GPU, 6, 2, 1, 1, background) draw.rect(GPU, 6, 2, 1, 1, colors.background)
draw.rect(GPU, 23, 8, 1, 1, background) draw.rect(GPU, 23, 8, 1, 1, colors.background)
end end
else else
if (machine.isWorkAllowed()) then if (machine.isWorkAllowed()) then
if f ~= accentA then if f ~= colors.accentA then
draw.rect(GPU, 6, 2, 1, 1, accentA) draw.rect(GPU, 6, 2, 1, 1, colors.accentA)
draw.rect(GPU, 23, 8, 1, 1, accentA) draw.rect(GPU, 23, 8, 1, 1, colors.accentA)
end end
else else
if f ~= errorColor then if f ~= colors.errorColor then
draw.rect(GPU, 6, 2, 1, 1, errorColor) draw.rect(GPU, 6, 2, 1, 1, colors.errorColor)
draw.rect(GPU, 23, 8, 1, 1, errorColor) draw.rect(GPU, 23, 8, 1, 1, colors.errorColor)
end end
end end
end end

View File

@ -1,5 +1,5 @@
-- Import section -- Import section
local computer = require("computer") computer = require("computer")
-- --
local notes = { local notes = {

View File

@ -1,11 +0,0 @@
machineBackground = 0x121010
progressBackground = 0x272c2e
labelColor = 0xFF00FF
errorColor = 0xFF0000
idleColor = 0xb300ff
workingColor = 0x00a6ff
positiveEUColor = 0x00CC00
negativeEUColor = 0xCC0000
timeColor = 0x5500FF
textColor = 0x000000
hudColor = 0x1E1E28

View File

@ -32,7 +32,7 @@ function mouseListener()
currentWindows["Button"].y * 2 + 1, currentWindows["Button"].y * 2 + 1,
6, 6,
6, 6,
negativeEUColor colors.negativeEUColor
) )
else else
G.rect( G.rect(
@ -41,7 +41,7 @@ function mouseListener()
currentWindows["Button"].y * 2 + 1, currentWindows["Button"].y * 2 + 1,
6, 6,
6, 6,
positiveEUColor colors.positiveEUColor
) )
if itemsToStock[drawerItem] ~= nil then if itemsToStock[drawerItem] ~= nil then
S.update(drawerItem, itemsToStock[drawerItem], number) S.update(drawerItem, itemsToStock[drawerItem], number)
@ -97,7 +97,7 @@ function keyboardListener()
number = number .. value number = number .. value
end end
G.rect(GPU, currentWindows["Number"].x + 2, currentWindows["Number"].y * 2 + 1, 46, 6, 0x333333) G.rect(GPU, currentWindows["Number"].x + 2, currentWindows["Number"].y * 2 + 1, 46, 6, 0x333333)
G.text(GPU, currentWindows["Number"].x + 4, currentWindows["Number"].y * 2 + 3, workingColor, number) G.text(GPU, currentWindows["Number"].x + 4, currentWindows["Number"].y * 2 + 3, colors.workingColor, number)
end end
end end
return event.listen("key_down", processKey) return event.listen("key_down", processKey)
@ -108,25 +108,25 @@ function getNewItem(GPU, x, y)
currentWindows["Item"].x = x currentWindows["Item"].x = x
currentWindows["Item"].y = y currentWindows["Item"].y = y
GPU.setActiveBuffer(itemWindow) GPU.setActiveBuffer(itemWindow)
G.rect(GPU, 2, 2, 58, 4, hudColor) G.rect(GPU, 2, 2, 58, 4, colors.hudColor)
G.rect(GPU, 3, 3, 56, 2, 0x000000) G.rect(GPU, 3, 3, 56, 2, 0x000000)
GPU.setActiveBuffer(0) GPU.setActiveBuffer(0)
end end
local newDrawerItem = transposer.getStackInSlot(sides.top, 2) local newDrawerItem = transposer.getStackInSlot(sides.top, 2)
if newDrawerItem ~= nil then if newDrawerItem ~= nil then
if craftables[newDrawerItem] ~= nil then if craftables[newDrawerItem] ~= nil then
GPU.setForeground(workingColor) GPU.setForeground(colors.workingColor)
else else
GPU.setActiveBuffer(negativeEUColor) GPU.setActiveBuffer(colors.negativeEUColor)
end end
if drawerItem == nil then if drawerItem == nil then
drawerItem = newDrawerItem.label drawerItem = newDrawerItem.label
GPU.setActiveBuffer(currentWindows["Item"].page) GPU.setActiveBuffer(currentWindows["Item"].page)
G.rect(GPU, 3, 3, 56, 2, 0x000000) G.rect(GPU, 3, 3, 56, 2, 0x000000)
if craftables[drawerItem] ~= nil then if craftables[drawerItem] ~= nil then
G.centeredText(GPU, 30, 3, positiveEUColor, drawerItem) G.centeredText(GPU, 30, 3, colors.positiveEUColor, drawerItem)
else else
G.centeredText(GPU, 30, 3, negativeEUColor, drawerItem) G.centeredText(GPU, 30, 3, colors.negativeEUColor, drawerItem)
end end
GPU.setActiveBuffer(0) GPU.setActiveBuffer(0)
if itemsToStock[drawerItem] ~= nil then if itemsToStock[drawerItem] ~= nil then
@ -146,9 +146,9 @@ function getNewItem(GPU, x, y)
GPU.setActiveBuffer(currentWindows["Item"].page) GPU.setActiveBuffer(currentWindows["Item"].page)
G.rect(GPU, 3, 3, 56, 2, 0x000000) G.rect(GPU, 3, 3, 56, 2, 0x000000)
if craftables[drawerItem] ~= nil then if craftables[drawerItem] ~= nil then
G.centeredText(GPU, 30, 3, positiveEUColor, drawerItem) G.centeredText(GPU, 30, 3, colors.positiveEUColor, drawerItem)
else else
G.centeredText(GPU, 30, 3, negativeEUColor, drawerItem) G.centeredText(GPU, 30, 3, colors.negativeEUColor, drawerItem)
end end
GPU.setActiveBuffer(0) GPU.setActiveBuffer(0)
if itemsToStock[drawerItem] ~= nil then if itemsToStock[drawerItem] ~= nil then
@ -182,7 +182,7 @@ function numberBox(GPU, x, y)
currentWindows["Number"].x = x currentWindows["Number"].x = x
currentWindows["Number"].y = y currentWindows["Number"].y = y
GPU.setActiveBuffer(itemWindow) GPU.setActiveBuffer(itemWindow)
G.rect(GPU, 2, 2, 48, 8, hudColor) G.rect(GPU, 2, 2, 48, 8, colors.hudColor)
G.rect(GPU, 3, 3, 46, 6, 0x000000) G.rect(GPU, 3, 3, 46, 6, 0x000000)
GPU.setActiveBuffer(0) GPU.setActiveBuffer(0)
end end
@ -193,8 +193,8 @@ function button(GPU, x, y)
currentWindows["Button"].x = x currentWindows["Button"].x = x
currentWindows["Button"].y = y currentWindows["Button"].y = y
GPU.setActiveBuffer(button) GPU.setActiveBuffer(button)
G.rect(GPU, 2, 2, 8, 8, hudColor) G.rect(GPU, 2, 2, 8, 8, colors.hudColor)
G.rect(GPU, 3, 3, 6, 6, workingColor) G.rect(GPU, 3, 3, 6, 6, colors.workingColor)
GPU.setActiveBuffer(0) GPU.setActiveBuffer(0)
end end
end end
@ -204,12 +204,12 @@ function craftableBox(GPU, x, y)
currentWindows["Craft"].x = x currentWindows["Craft"].x = x
currentWindows["Craft"].y = y currentWindows["Craft"].y = y
GPU.setActiveBuffer(crafts) GPU.setActiveBuffer(crafts)
G.rect(GPU, 2, 2, 70, 94, hudColor) G.rect(GPU, 2, 2, 70, 94, colors.hudColor)
GPU.setActiveBuffer(0) GPU.setActiveBuffer(0)
end end
GPU.setActiveBuffer(currentWindows["Craft"].page) GPU.setActiveBuffer(currentWindows["Craft"].page)
G.rect(GPU, 3, 4, 68, 90, 0x000000) G.rect(GPU, 3, 4, 68, 90, 0x000000)
G.rect(GPU, 48, 2, 1, 94, hudColor) G.rect(GPU, 48, 2, 1, 94, colors.hudColor)
local i = 1 local i = 1
S.updateCache() S.updateCache()
for label, amount in pairs(itemsToStock) do for label, amount in pairs(itemsToStock) do
@ -219,16 +219,16 @@ function craftableBox(GPU, x, y)
if S.uniques() > 2500 then --Check against rebooted system if S.uniques() > 2500 then --Check against rebooted system
if toStock > 0 then if toStock > 0 then
if drawerItem == label then if drawerItem == label then
G.text(GPU, 4, 3 + 2 * i, workingColor, label) G.text(GPU, 4, 3 + 2 * i, colors.workingColor, label)
elseif craftables[label] == nil then elseif craftables[label] == nil then
G.text(GPU, 4, 3 + 2 * i, negativeEUColor, label) G.text(GPU, 4, 3 + 2 * i, colors.negativeEUColor, label)
else else
G.text(GPU, 4, 3 + 2 * i, 0xFFFFFF, label) G.text(GPU, 4, 3 + 2 * i, 0xFFFFFF, label)
end end
if stockedAmount >= toStock then --In stock if stockedAmount >= toStock then --In stock
G.text(GPU, 59 - (#stockedString + 1), 3 + 2 * i, 0xFFFFFF, stockedString) G.text(GPU, 59 - (#stockedString + 1), 3 + 2 * i, 0xFFFFFF, stockedString)
elseif stockedAmount >= toStock * 0.85 then --Edit hysteresis here, slightly below stock elseif stockedAmount >= toStock * 0.85 then --Edit hysteresis here, slightly below stock
G.text(GPU, 59 - (#stockedString + 1), 3 + 2 * i, workingColor, stockedString) G.text(GPU, 59 - (#stockedString + 1), 3 + 2 * i, colors.workingColor, stockedString)
else --Needs to be ordered else --Needs to be ordered
--Add crafting request loop here --Add crafting request loop here
if craftables[label] ~= nil then if craftables[label] ~= nil then
@ -238,7 +238,7 @@ function craftableBox(GPU, x, y)
currentlyCrafting[label] = nil currentlyCrafting[label] = nil
end end
end end
G.text(GPU, 59 - (#stockedString + 1), 3 + 2 * i, negativeEUColor, stockedString) G.text(GPU, 59 - (#stockedString + 1), 3 + 2 * i, colors.negativeEUColor, stockedString)
end end
G.text(GPU, 59, 3 + 2 * i, 0xFFFFFF, "| " .. amount) G.text(GPU, 59, 3 + 2 * i, 0xFFFFFF, "| " .. amount)
i = math.min(i + 1, 43) i = math.min(i + 1, 43)

View File

@ -2,7 +2,7 @@
local parser = require("util.parser") local parser = require("util.parser")
local inherits = require("util.class.inherits") local inherits = require("util.class.inherits")
local SingleBlock = require("data.datasource.single-block") local SingleBlock = require("data.datasource.single-block")
local mock = require("data.mock.mock-energy-provider") local mock = require("mock-energy-provider")
-- --
local EnergyProvider = local EnergyProvider =

View File

@ -2,7 +2,7 @@
local parser = require("util.parser") local parser = require("util.parser")
local inherits = require("util.class.inherits") local inherits = require("util.class.inherits")
local SingleBlock = require("data.datasource.single-block") local SingleBlock = require("data.datasource.single-block")
local mock = require("data.mock.mock-multi-block") local mock = require("mock-multi-block")
-- --
local MultiBlock = local MultiBlock =

View File

@ -1,6 +1,6 @@
-- Import section -- Import section
local component = require("component") local component = require("component")
local mock = require("data.mock.mock-single-block") local mock = require("mock-single-block")
-- --
local SingleBlock = { local SingleBlock = {

View File

@ -9,13 +9,11 @@ local function exec(energyProducers, energyBuffer)
local consumption = energyBuffer:getAverageInput() local consumption = energyBuffer:getAverageInput()
local production = energyBuffer:getAverageOutput() local production = energyBuffer:getAverageOutput()
local energyCapacity = energyBuffer:getTotalEnergy().maximum local energyCapacity = energyBuffer:getTotalEnergy().maximum
local timeToFull = energyCapacity / (production - consumption) local timeToFull = (production - consumption) ~= 0 and energyCapacity / (production - consumption) or "-"
local timetoEmpty = -timeToFull
return { return {
consumption = consumption, consumption = consumption,
production = production, production = production,
timeToFull = timeToFull, timeToFull = timeToFull,
timetoEmpty = timetoEmpty
} }
end end

View File

@ -1,13 +1,14 @@
-- Import section -- Import section
Computer = require("computer") computer = require("computer")
Component = require("component") comp = require("component")
MultiBlock = require("data.datasource.multi-block") MultiBlock = require("data.datasource.multi-block")
SingleBlock = require("data.datasource.single-block") SingleBlock = require("data.datasource.single-block")
EnergyProvider = require("data.datasource.energy-provider") EnergyProvider = require("data.datasource.energy-provider")
local cleanroomAddresses = require("data.database.cleanroom") local cleanroomAddresses = require("cleanroom")
local multiBlockAddresses = require("data.database.multi-blocks") local multiBlockAddresses = require("multi-blocks")
local energyBufferAddress = require("data.database.energy-buffer") local energyBufferAddress = require("energy-buffer")
local protectCleanroomRecipes = require("domain.cleanroom.protect-recipes-usecase") local protectCleanroomRecipes = require("domain.cleanroom.protect-recipes-usecase")
local getMultiblockStatuses = require("domain.multiblock.get-status-usecase") local getMultiblockStatuses = require("domain.multiblock.get-status-usecase")
local getEnergyStatus = require("domain.energy.get-energy-status-usecase") local getEnergyStatus = require("domain.energy.get-energy-status-usecase")
@ -15,7 +16,7 @@ local getEnergyStatus = require("domain.energy.get-energy-status-usecase")
local cleanroom = MultiBlock:new(multiBlockAddresses.cleanroom) local cleanroom = MultiBlock:new(multiBlockAddresses.cleanroom)
local cleanroomMachines = {} local cleanroomMachines = {}
for address in pairs(cleanroomAddresses.machines) do for _, address in pairs(cleanroomAddresses) do
table.insert(cleanroomMachines, SingleBlock:new(address)) table.insert(cleanroomMachines, SingleBlock:new(address))
end end
@ -27,11 +28,7 @@ local energyBuffer = EnergyProvider:new(energyBufferAddress)
local energyProducers = {} local energyProducers = {}
local i = 1 for i = 0, 100 do
while true do
if (i > 100) then
break
end
print(i) print(i)
protectCleanroomRecipes(cleanroom, cleanroomMachines) protectCleanroomRecipes(cleanroom, cleanroomMachines)
local multiblockStatuses = getMultiblockStatuses(multiblocks) local multiblockStatuses = getMultiblockStatuses(multiblocks)

View File

@ -1,5 +1,5 @@
-- Import section -- Import section
local playTune = require("api.sound.play-tune") local playTune = require("play-tune")
-- --
local tune = { local tune = {

View File

@ -1,5 +1,5 @@
-- Import section -- Import section
local playTune = require("api.sound.play-tune") local playTune = require("play-tune")
-- --
local tune = { local tune = {

View File

@ -1,5 +1,5 @@
-- Import section -- Import section
local playTune = require('api.sound.play-tune') local playTune = require('play-tune')
-- --
local tune = { local tune = {

View File

@ -1,2 +0,0 @@
return function (arg1, arg2, arg3)
end

View File

@ -1,3 +0,0 @@
return function (arg1, arg2, arg3)
end

View File

@ -1,3 +0,0 @@
return function (arg1, arg2, arg3)
end