Advertisement
Kaosce

Reactor_Controller_Advanced

Mar 24th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 0 0
  1. --This Code is currently incomplet. Come back later, I'll go sleep now :D
  2.  
  3. local function mvprint(lign, col, str)
  4.     p.setCursorPos(col, lign)
  5.     p.write(str)
  6. end
  7.  
  8. local function termprint(str)
  9.     term.clear()
  10.     term.setCursorPos(1, 1)
  11.     term.write(str)
  12. end
  13.  
  14. local function initialisation()
  15.     term.clear()
  16.     while (peripheral.isPresent("back") == false or peripheral.getType("back") ~= "BigReactors-Reactor") do
  17.         termprint("Please, connect a Reactor to the back")
  18.         sleep(1)
  19.     end
  20.     reactor = peripheral.wrap("back")
  21.     while (peripheral.isPresent("top") == false or peripheral.getType("top") ~= "monitor") do
  22.         termprint("Please, connect a Monitor to the top")
  23.         sleep(1)
  24.     end
  25.     p = peripheral.wrap("top")
  26.     p.setBackgroundColor(colors.black)
  27.     p.clear()
  28.     width, height = p.getSize()
  29.     width = width + 1
  30.     height = height + 1
  31.     c_width = width / 2
  32.     c_height = height / 2
  33.     while (p.isColor() == false) do
  34.         mvprint(c_height, c_width - string.len("Le moniteur ne supporte pas la couleur!") / 2)
  35.         sleep(1)
  36.     end
  37. end
  38.  
  39. local function management()
  40.     p.clear()
  41.     mvprint(2, c_width - string.len("Managing:") / 2, "Managing:")
  42.     p.setBackgroundColor(colors.green)
  43.     mvprint(c_height, 1 + 3, "ON")
  44.     p.setBackgroundColor(colors.red)
  45.     mvprint(c_height, width - string.len("   ") - 3, "OFF")
  46. end
  47.  
  48. initialisation()
  49. management()
  50. print("END")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement