Advertisement
TheRockettek

Untitled

Jan 5th, 2017
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. print("Locating controller...")
  2. for i,k in pairs(peripheral.getNames()) do
  3. if peripheral.getType(k) == "refinedstorage:controller" then
  4. print("Controller: " .. k)
  5. controller = peripheral.wrap(k)
  6. end
  7. end
  8. print("Locating monitor...")
  9. for i,k in pairs(peripheral.getNames()) do
  10. if peripheral.getType(k) == "monitor" then
  11. print("Monitor: " .. k)
  12. monitor = peripheral.wrap(k)
  13. end
  14. end
  15. print("Getting monitor size...")
  16. resolution = {monitor.getSize()}
  17. print("Width: " .. resolution[1] .. " Height: " .. resolution[2])
  18. print("Is colour: " .. tostring(monitor.isColour()))
  19. if not monitor.isColour() then
  20. error("Colour monitor needed")
  21. end
  22.  
  23. term.redirect(monitor)
  24. term.clear()
  25. term.setTextColour(colours.white)
  26. term.setBackgroundColour(colours.black)
  27. term.clear()
  28. while true do
  29. ttlitems = controller.listAvailableItems()
  30. ttlcount = 0
  31. for i,k in pairs(ttlitems) do
  32. if k['count'] then
  33. ttlcount = ttlcount + k['count']
  34. end
  35. end
  36. term.setTextColour(colours.white)
  37. term.setCursorPos(2,2)
  38. term.write("Energy: ")
  39. term.setCursorPos(10,2)
  40. perc = (controller.getRFStored() / controller.getRFCapacity()) * 100
  41. if perc >= 90 then
  42. term.setTextColour(colours.green)
  43. elseif perc <= 89 and perc >= 70 then
  44. term.setTextColour(colours.lime)
  45. elseif perc <= 69 and perc >= 50 then
  46. term.setTextColour(colours.yellow)
  47. elseif perc <= 49 and perc >= 20 then
  48. term.setTextColour(colours.orange)
  49. else
  50. term.setTextColour(colours.red)
  51. end
  52. term.write(controller.getRFStored() .. "RS/" .. controller.getRFCapacity() .. "RS")
  53. term.setCursorPos(2,3)
  54. term.setTextColour(colours.white)
  55. term.write("Total items:")
  56. term.setCursorPos(15,3)
  57. term.setTextColour(colours.cyan)
  58. term.write(tostring(ttlcount))
  59. term.setCursorPos(2,4)
  60. term.setTextColour(colours.white)
  61. term.write("Active crafting tasks: " .. #controller.getCraftingTasks())
  62. sleep(0)
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement