Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local g = require("component").glasses
- local reactor = require("component").reactor
- local sides = require("sides")
- local red = require("component").redstone
- local event = require("event")
- local gpu = require("component").gpu
- local mfe = require("component").ic2_te_mfe
- red.setOutput(sides.down, 0)
- g.removeAll()
- function newButton(massive, x, y, w, h, color, func)
- massive[#massive + 1] = {g.addRect(), func}
- massive[#massive][1].setColor(color[1], color[2], color[3])
- massive[#massive][1].setSize(w, h)
- massive[#massive][1].setPosition(x, y)
- return massive
- end
- local eu = g.addTextLabel()
- local heat = g.addTextLabel()
- eu.setPosition(23, 7)
- eu.setScale(0.6)
- eu.setColor(0, 1/0.3, 1/0.3)
- os.sleep(0.1)
- heat.setPosition(23, 14)
- heat.setScale(0.6)
- heat.setColor(0, 1/0.3, 1/0.3)
- os.sleep(0.1)
- local status = g.addTextLabel()
- status.setText("status: waiting")
- status.setPosition(2, 21)
- status.setScale(0.6)
- status.setColor(1,1,1)
- local energySub = g.addRect()
- local energyFore = g.addRect()
- energySub.setColor(37/100, 42/100, 101/100)
- energyFore.setColor(1, 1, 0)
- energySub.setSize(50, 3)
- energyFore.setSize(50, 0)
- energySub.setPosition(1, 18)
- energyFore.setPosition(1, 18)
- energyText = g.addTextLabel()
- energyText.setScale(0.6)
- energyText.setColor(0, 1/0.3, 1/0,3)
- energyText.setPosition(2, 35)
- function info()
- progressBarFore.setSize(reactor.getHeat() / 100 / 2, 3)
- energyFore.setSize((100 / (mfe.getCapacity() / mfe.getEnergy())) / 2, 3)
- energyText.setText("MFE: " .. math.floor(mfe.getEnergy()) .. "/" .. math.floor(mfe.getCapacity()) .. " (" .. math.floor((100 / (mfe.getCapacity() / mfe.getEnergy()))) .. "%)")
- if reactor.getHeat() / 100 >= 80 and red.getOutput(sides.down) > 0 then red.setOutput(sides.down, 0) buttons[1][1].setColor(1, 1, 0) status.setText("status: interrupted")end
- eu.setText("EU Output: " .. reactor.getReactorEnergyOutput())
- heat.setText("Heat: " .. reactor.getHeat() / 100 .. "%")
- end
- function pull(massive)
- while not massive.close do
- local type, _, _, x, y, mode = event.pull(0.1)
- for i = 1, #massive do
- local posX, posY = massive[i][1].getPosition()
- local w, h = massive[i][1].getSize()
- if type == "interact_overlay" then
- if x >= posX and x < w + posX and y >= posY and y < h + posY then
- massive[i][2]()
- end
- end
- end
- info()
- end
- end
- progressBarBack = g.addRect()
- progressBarBack.setColor(49 / 100, 49 / 100, 49 / 100)
- progressBarBack.setSize(50, 3)
- progressBarBack.setPosition(1, 1)
- progressBarFore = g.addRect()
- progressBarFore.setColor(1, 0, 0)
- progressBarFore.setPosition(1, 1)
- OnOff = g.addRect()
- OnOff.setSize(12, 8)
- OnOff.setColor(0, 1, 0)
- OnOff.setPosition(1, 5)
- function OOF()
- if red.getOutput(sides.down) > 0 then
- OnOff.setColor(0, 1, 0)
- red.setOutput(sides.down, 0)
- status.setText("status: waiting")
- else
- OnOff.setColor(1, 0, 0)
- red.setOutput(sides.down, 15)
- status.setText("status: working")
- end
- end
- function exit()
- red.setOutput(sides.down, 0)
- buttons.close = true
- end
- buttons = {
- {OnOff, OOF}
- }
- buttons = newButton(buttons, 640 - 6, 1, 5, 5, {1,0,0}, exit)
- info()
- os.sleep(0.1)
- pull(buttons)
- g.removeAll()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement