Jackson_Pike icon

Reactor Hatch

Jackson_Pike | PRO | 04/08/22 09:06:14 AM UTC | 0 ⭐ | 1284 👁️ | Never ⏰ | []
Lua |

1.71 KB

|

None

|

0 👍

/

0 👎

if fs.exists("pikeLib") then
  exists = true
else 
  shell.run("pastebin get nXvVUSuw pikeLib")
end
 
if exists then
  print(os.loadAPI("pikeLib"))
else
  term.clear()
  term.setCursorPos(1, 1)
  term.setTextColor(colors.red)
  print("Missing dependences...pikeLib API not found")
  os.exit()
end
 
term.clear()
term.setCursorPos(1, 1)
term.write("Attempting to attach monitor...")
-------------
local dsp = pikeLib.fetchPeripheral()
if test == "FAILED" then
  term.setTextColor(colors.red)
  print("FAILED")
  os.exit()
else
  term.setTextColor(colors.green)
  term.write("Success!")
end
 
dsp.setTextScale(0.75)
redstone.setAnalogOutput("bottom", 0)
doorOpen = false
 
function printDisplay()
  monx, mony = dsp.getSize()
  dsp.setBackgroundColor(colors.black)
  dsp.clear()
  dsp.setTextColor(colors.white)
  dsp.setCursorPos(1, 1)
  dsp.setBackgroundColor(colors.gray)
  dsp.write(string.rep(" ", monx))
  dsp.setCursorPos(1, mony)
  dsp.write(string.rep(" ", monx))
  dsp.setBackgroundColor(colors.black)
  dsp.setTextColor(colors.red)
  dsp.setCursorPos(1, 3)
 
  dsp.setBackgroundColor(colors.black)
  dsp.clear()
 
  pikeLib.drawBars(colors.blue, 1, dsp)
  pikeLib.drawBars(colors.blue, mony, dsp)
  
 
  if doorOpen then 
    printText = "Close Reactor Hatch"
  else
    printText = "Open Reactor Hatche"
  end
 
  pikeLib.easyWrite(pikeLib.Positions[5],
   colors.black, colors.red, printText, dsp)
end
printDisplay()
 
repeat
  event, side, xpos, ypos = os.pullEvent("monitor_touch")
  if side == "top" then
    pikeLib.toggleRedstone("bottom")
    if doorOpen then
      doorOpen = false
    else 
      doorOpen = true
    end
    printDisplay()
  end
until false
 

Comments