Rename configuration.lua to match calls to it

Add a limit of 20 to displayed TPS
This commit is contained in:
Sampsa 2020-10-31 21:05:49 +02:00
parent faff7bfa45
commit c5afc10bff
5 changed files with 1 additions and 145 deletions

View File

@ -413,7 +413,7 @@ function ARWidgets.displayTPS(glasses, x, y)
local stripe4 = ARG.hudRectangle(glasses, x+1, y+2, 1, 19, workingColour)
TPSText = ARG.hudText(glasses, "", x+42, y+6, workingColour, 1)
end
local tps = get.tps()
local tps = math.min(20.00, get.tps())
if tps > 15 then
TPSText.setText("TPS: "..string.sub(tps, 1, 5))
TPSText.setColor(ARG.hexToRGB(positiveEUColour))

View File

@ -1,55 +0,0 @@
comp = require("component"); event = require("event")
ARG = require("ARGraphics"); get = require("easy"); config = require("config")
comp.glasses.removeAll()
local initializeCpuMonitor = true
local cpuLights = {}
local function cpuMonitor(glasses, x, y)
if initializeCpuMonitor then
local base = ARG.hudRectangle(glasses, x, y, 28, 24, hudColour)
local topStrip = ARG.hudRectangle(glasses, x, y, 500, 3, hudColour)
local itemBorder1 = ARG.hudRectangle(glasses, x+28, y+3, 1, 21, workingColour, 0.8)
local itemBorder2 = ARG.hudRectangle(glasses, x+28, y+3, 61, 1, workingColour, 0.8)
local itemBorder3 = ARG.hudRectangle(glasses, x+88, y+3, 1, 21, workingColour, 0.8)
local itemBorder4 = ARG.hudRectangle(glasses, x+28, y+23, 61, 1, workingColour, 0.8)
local cpuBase1 = ARG.hudRectangle(glasses, x+89, y, 5, 24, hudColour)
local cpuBase2 = ARG.hudRectangle(glasses, x+94, y+12, 8, 12, hudColour)
local cpuSplitter = ARG.hudRectangle(glasses, x+89, y+9, 400, 3, hudColour)
local cpuSplitter2 = ARG.hudRectangle(glasses, x+102, y+18, 380, 6, hudColour)
local function createCpuIndicator(cpuX, cpuY)
local status = ARG.hudQuad(glasses, {cpuX, cpuY}, {cpuX+6, cpuY+6}, {cpuX+16, cpuY+6}, {cpuX+10, cpuY}, hudColour, 1.0)
local leftTriangle = ARG.hudTriangle(glasses, {cpuX, cpuY}, {cpuX, cpuY+6}, {cpuX+6, cpuY+6}, hudColour)
local rightTriangle = ARG.hudQuad(glasses, {cpuX+10, cpuY}, {cpuX+16, cpuY+6}, {cpuX+18, cpuY+6}, {cpuX+18, cpuY}, hudColour)
return status
end
local i = 0
local j = 0
local cpuNumber = 1
while i+j < 24 do
if (i+j) % 2 == 1 then
cpuLights[cpuNumber] = createCpuIndicator(x+102+j*17, y+12)
j = j + 1
else
cpuLights[cpuNumber] = createCpuIndicator(x+94+i*17, y+3)
i = i + 1
end
cpuNumber = cpuNumber + 1
end
local rowStop1 = ARG.hudRectangle(glasses, x+94+i*17, y+3, 300, 6, hudColour)
local rowStop2 = ARG.hudRectangle(glasses, x+102+j*17, y+12, 300, 6, hudColour)
local horizontalStrip = ARG.hudRectangle(glasses, x+100, y+22, 210, 1, workingColour)
local diagonalStrip = ARG.hudQuad(glasses, {x+89, y+11}, {x+89, y+12}, {x+100, y+23}, {x+100, y+22}, workingColour)
initializeCpuMonitor = false
end
local cpus = comp.me_interface.getCpus()
for i = 1, #cpus, 1 do
if cpus[i].busy then
cpuLights[i].setColor(ARG.hexToRGB(positiveEUColour))
else
cpuLights[i].setAlpha(0.7)
cpuLights[i].setColor(ARG.hexToRGB(workingColour))
end
end
end
while true do
cpuMonitor(comp.glasses, 520, 449)
end

View File

@ -1,48 +0,0 @@
comp = require("component"); event = require("event")
ARG = require("ARGraphics"); get = require("easy"); config = require("config")
ARW = require("ARWidgets")
function popupText(glasses, text, x, y, color)
local substringLength = 1
local width = #text * 5
local steps = math.ceil(#text / substringLength)
local stepLength = substringLength * 5
local i = 1
local background = ARG.hudQuad(glasses, {x-5, y}, {x-5, y+9}, {x-5+1, y+9}, {x-5+1, y}, 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 bottom = ARG.hudQuad(glasses, {x-5, y+9}, {x-5, y+10}, {x-5+1, y+10}, {x-5+1, y+9}, machineBackground)
local hudText = ARG.hudText(glasses, "", x+1, y+1, color)
local wedge = ARG.hudQuad(glasses, {x-5-10, y-1}, {x-5, y-1}, {x-5, y+10}, {x-5+11, y+10}, machineBackground)
local direction = 1
local function advance()
background.setVertex(3, math.min(width + 10, x + stepLength * i + 10), y+9)
background.setVertex(4, math.min(width, x + stepLength * i), y)
top.setVertex(3, math.min(width, x + stepLength * i), y)
top.setVertex(4, math.min(width, x + stepLength * i), y-1)
bottom.setVertex(3, math.min(width + 10, x + stepLength * i + 10), y+10)
bottom.setVertex(4, math.min(width + 10, x + stepLength * i + 10), y+9)
wedge.setVertex(1, math.min(width-1, x + stepLength * i-1), y-1)
wedge.setVertex(2, math.min(width + 10, x + stepLength * i + 10), y+10)
wedge.setVertex(3, math.min(width + 11, x + stepLength * i + 11), y+10)
wedge.setVertex(4, math.min(width + 1, x + stepLength * i + 1), y-1)
hudText.setText(string.sub(text, 1, substringLength * i))
i = i + direction
if i < 0 then
glasses.removeObject(background.getID())
glasses.removeObject(top.getID())
glasses.removeObject(bottom.getID())
glasses.removeObject(hudText.getID())
glasses.removeObject(wedge.getID())
end
end
local function retract()
direction = -1
event.timer(0.03, advance, steps+2)
end
event.timer(0.03, advance, steps)
return retract
end
a = popupText(comp.glasses, "Made by Sampsa ", 0, 50, workingColour)
b = popupText(comp.glasses, "Widget breakdown in comments!", 0, 65, workingColour)
c = popupText(comp.glasses, "+ github!", 0, 80, workingColour)

View File

@ -1,41 +0,0 @@
comp = require("component"); event = require("event")
AR = require("ARWidgets")
ARG = require("ARGraphics")
local wSampsa, hSampsa = 853, 473
local powerHudX, powerHudY, powerHudW, powerHudH = 0, hSampsa-24, wSampsa*0.39+3, 14
comp.glasses.removeAll()
AR.minimapOverlay(comp.glasses); AR.hudOverlayBase(comp.glasses, wSampsa, hSampsa); AR.clear();
screen.clear()
while true do
AR.powerDisplay(comp.glasses, comp.gt_machine, powerHudX, powerHudY, powerHudW, powerHudH)
AR.fluidMonitor(comp.glasses, 795, 153, {
[0] = {label = "Oxygen Gas", displayName = "Oxygen", color = 0x688690, max = 128},
[1] = {label = "Nitrogen Gas", displayName = "Nitrogen", color = 0x976868, max = 128},
[2] = {label = "Hydrogen Gas", displayName = "Hydrogen", color = 0xa78282, max = 128},
[3] = {label = "fluid.chlorine", displayName = "Chlorine", color = 0x428282, max = 128},
[4] = {label = "fluid.radon", displayName = "Radon", color = 0xff5bff, max = 2},
[5] = {label = "UU-Matter", displayName = "UU Matter", color = 0x4a0946, max = 2},
[6] = {label = "fluid.molten.plastic", displayName = "Rubber", color = 0x050505, max = 2},
[7] = {label = "fluid.molten.polytetrafluoroethylene", displayName = "PTFE", color = 0x4d4d4d, max = 2},
[8] = {label = "fluid.molten.styrenebutadienerubber", displayName = "SBR", color = 0x1d1817, max = 2},
[9] = {label = "fluid.molten.epoxid", displayName = "Epoxid", color = 0x9d6f13, max = 2},
[10] = {label = "fluid.molten.silicone", displayName = "Silicone Rubber", color = 0xa5a5a5, max = 2},
[11] = {label = "fluid.molten.polybenzimidazole", displayName = "PBI", color = 0x262626, max = 2}
}
)
os.sleep()
end
while true do
itemTicker(comp.glasses, 348, 0, 380)
end
--Widget ideas:
-- Charge level indicator for everything
-- Inventory fill level monitoring
-- Autocrafting CPU usage
-- Item stocker script
-- Maintenance Monitoring
-- Total amount of items in AE
-- Total amount of craftables
-- Total amount of unique items