bobmarley12345

combustionEnginesInfoCC

Oct 16th, 2020 (edited)
509
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MonitorSide = "right"
  2. RedstoneInputsSide = "left"
  3. CombustionColour = colours.orange
  4. MEImportColour = colours.magenta
  5. Monitor = peripheral.wrap(MonitorSide)
  6.  
  7. function ClearMonitor()
  8.     Monitor.setTextColor(colours.black)
  9.     Monitor.setBackgroundColor(colours.black)
  10.     Monitor.clear()
  11.     Monitor.setCursorPos(1,1)
  12. end
  13.  
  14. function DrawText(xPos, yPos, text, textColour, backgroundColour)
  15.     Monitor.setBackgroundColor(backgroundColour)
  16.     Monitor.setTextColor(textColour)
  17.     Monitor.setCursorPos(xPos,yPos)
  18.     Monitor.write(text)
  19. end
  20.  
  21. function DrawCenteredHorizontal(xPos, yPos, width, text, textColour, backgroundColour)
  22.     local textLength = string.len(text)
  23.     local centerX = (width / 2) - (textLength / 2)
  24.     DrawText(xPos + centerX, yPos, text, textColour, backgroundColour)
  25. end
  26.  
  27. function Main()
  28.     while true do
  29.         local w, h = Monitor.getSize()
  30.         local inputColours = redstone.getBundledInput(RedstoneInputsSide)
  31.         local isCombustionOn = colours.test(inputColours, CombustionColour)
  32.         local isMEImportOn = colours.test(inputColours, MEImportColour)
  33.        
  34.         ClearMonitor()
  35.         DrawText(2, 2, "Engines: ", colours.white, colours.black)
  36.         if (isCombustionOn) then DrawText(12, 2, "ONLINE", colours.white, colours.green)
  37.         else DrawText(12, 2, "OFFLINE", colours.white, colours.red) end
  38.    
  39.         DrawText(2, 4, "MEImport: ", colours.white, colours.black)
  40.         if (isMEImportOn) then DrawText(12, 4, "ONLINE", colours.white, colours.green)
  41.         else DrawText(12, 4, "OFFLINE", colours.white, colours.red) end
  42.    
  43.         os.sleep(1)
  44.     end
  45. end
  46.  
  47. Main()
RAW Paste Data