Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("right")
- r = peripheral.wrap("back")
- image = paintutils.loadImage("hud")
- m.setBackgroundColor(colors.black)
- m.clear()
- paintutils.drawImage(image,1,1)
- m.setCursorPos(40,16)
- m.write("Reacteur")
- function mo_touch()
- while true do
- event, side, xpos, ypos = os.pullEvent("monitor_touch")
- if xpos == 3 or xpos == 4 and ypos == 2 then
- r.setActive(true)
- elseif xpos == 45 or xpos == 46 and ypos == 2 then
- r.setActive(false)
- end
- end
- end
- function test_r()
- while true do
- if r.getActive() then
- e = r.getEnergyStored()
- ep = r.getEnergyProducedLastTick()
- paintutils.drawBox(3,15,5,16,colors.green)
- paintutils.drawFilledBox(3,3,47,13,colors.black)
- paintutils.drawBox(4,4,46,12,colors.gray)
- m.setCursorPos(6,6)
- m.setTextColor(colors.green)
- m.setBackgroundColor(colors.black)
- m.write("Energie Stored : "..e.." RF")
- m.setCursorPos(6,8)
- m.write("Energie Produite : "..ep.." RF/t")
- if e == 10000000 then
- os.sleep(3)
- r.setActive(false)
- end
- os.sleep(0.1)
- elseif r.getActive() == false then
- e = r.getEnergyStored()
- paintutils.drawBox(3,15,5,16,colors.red)
- paintutils.drawFilledBox(3,3,47,13,colors.black)
- paintutils.drawBox(4,4,46,10,colors.gray)
- m.setCursorPos(6,6)
- m.setTextColor(colors.red)
- m.setBackgroundColor(colors.black)
- m.write("Energie Stored : "..e.." RF")
- os.sleep(0.1)
- end
- os.sleep(0.1)
- end
- end
- function hud()
- paintutils.drawImage(image, 1, 1)
- end
- hud()
- parallel.waitForAny(test_r, mo_touch)
Add Comment
Please, Sign In to add comment