Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("touchAPI")
- touchAPILocation = {}
- mode = ""
- pcState = ""
- function bootINIT()
- local perList = peripheral.getNames()
- for i=1,#perList do
- if peripheral.getType(perList[i]) == "monitor" then
- touchAPILocation = perList[i]
- mon = peripheral.wrap(perList[i])
- touch = touchAPI.new(touchAPILocation)
- elseif peripheral.getType(perList[i]) == "BigReactors-Reactor" then
- r = peripheral.wrap(perList[i])
- enMaxR = 10000000
- elseif peripheral.getType(perList[i]) == "dimension_builder" then
- dim = peripheral.wrap(perList[i])
- elseif peripheral.getType(perList[i]) == "tile_blockcapacitorbank_name" then
- c = peripheral.wrap(perList[i])
- capBankLocation = perList[i]
- elseif peripheral.getType(perList[i]) == "tilecontroller" then
- ae = peripheral.wrap(perList[i])
- elseif peripheral.getType(perList[i]) == "computer" then
- pc = peripheral.wrap(perList[i])
- end
- end
- end
- bootINIT()
- mon.setBackgroundColor(colors.gray)
- function getEvent()
- local event,but
- while true do
- local timer = os.startTimer(0.5)
- event, but = touch:handleEvents(os.pullEvent())
- if event == "button_click" then
- if but == "Speicher" then
- mode = "Speicher"
- mon.clear()
- touch:draw()
- elseif but == "Reaktor" then
- mode = "Reaktor"
- mon.clear()
- touch:draw()
- elseif but == "Dimension" then
- mode = "Dimension"
- elseif but == "AE-System" then
- mode = "AE-System"
- mon.clear()
- touch:draw()
- end
- touch.buttonList[but].func()
- else
- if mode == "Speicher" then
- getEnergyInfo()
- elseif mode == "Reaktor" then
- elseif mode == "Dimension" then
- elseif mode == "AE-System" then
- getAeInfo()
- end
- sleep(0.5)
- end
- end
- end
- function getEnergyInfo()
- mon.setBackgroundColor(colors.black)
- enMIO = c.getMaxEnergyStored()
- if peripheral.getType(capBankLocation) == "tile_blockcapacitorbank_name" then
- enC = c.getEnergyStored()
- enPer = math.floor(enC/enMIO*100)
- if enMIO == 25000000 then
- cType = "Vibrant Capacitor Bank"
- elseif enMIO == 5000000 then
- cType = "Capacitor Bank "
- elseif enMIO == 1000000 then
- cType = "Basic Capacitor Bank "
- end
- enC = c.getEnergyStored()
- sleep(0.1)
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(3,4)
- mon.write("Speicher Typ: "..cType)
- mon.setCursorPos(3,5)
- mon.write("Fuellstand: "..enPer.." % ")
- end
- end
- function createTermScreen()
- local menutext = colors.black
- term.clear()
- paintutils.drawImage(paintutils.loadImage("screensaver"),2,2)
- end
- createTermScreen()
- function getCenterPos()
- local x, y = mon.getSize()
- xCen = x/2
- yCen = y/2
- end
- function UpdateManual()
- getCenterPos()
- mon.clear()
- mon.setBackgroundColor(colors.gray)
- mon.setCursorPos(xCen, yCen)
- shell.run("rm Update")
- shell.run("rm blsOS")
- sleep(0.2)
- shell.run("pastebin get cTQQpqxR Update")
- shell.run("pastebin get Xgih2Zyu blsOS")
- sleep(2)
- shell.run("Update")
- mon.write("Neueste Version installiert!")
- mon.clear()
- os.reboot()
- end
- function getAeInfo()
- aeN = ae.getEnergyStored()
- aeM = ae.getMaxEnergyStored()
- aePer = math.floor(aeN/aeM*100)
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(3,4)
- mon.write("Me-System-Strom")
- mon.setCursorPos(3,5)
- mon.write("Fuellstand: "..aePer.." % ")
- end
- function getReactorInfo()
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(3,4)
- mon.write("Fahre Turbinen Controller herunter...")
- pc.shutdown()
- mon.setCursorPos(3,5)
- os.sleep(0.2)
- mon.write("Starte Synchronisation...")
- mon.setCursorPos(3,6)
- os.sleep(0.2)
- mon.write("Fahre Turbinen Controller hoch...")
- pc.turnOn()
- pcState = "on"
- end
- touch:add("AE-System", getAeInfo, 36, 1, 46, 1)
- touch:add("Speicher", getEnergyInfo, 25, 1, 34, 1)
- touch:add("Reaktor", getReactorInfo, 15, 1, 23, 1)
- touch:add("Dimension", getDimensionBuilderInfo, 3, 1, 13, 1)
- touch:add("Update", UpdateManual, 3, 19, 12, 19)
- touch:add("Neustart", function() touch:flash("Neustart") os.reboot() end, 14, 19, 23, 19)
- touch:draw()
- function start()
- local event,but
- while true do
- event,but = touch:handleEvents(os.pullEvent())
- if event == "button_click" then
- if but == "Speicher" then
- mode = "Speicher"
- break
- elseif but == "Reaktor" then
- mode = "Reaktor"
- break
- elseif but == "Dimension" then
- mode = "Dimension"
- break
- elseif but == "AE-System" then
- mode = "AE-System"
- break
- elseif but == "Update" or but == "Neustart" then
- break
- end
- end
- end
- touch.buttonList[but].func()
- end
- start()
- getEvent()
- --while true do
- -- getEnergyInfo()
- -- getEvent()
- --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement