Advertisement
Guest User

Untitled

a guest
Oct 24th, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. local component = require("component")
  2. local cell = component.tile_thermalexpansion_cell_resonant_name
  3. local rs = component.redstone
  4. local sides = require("sides")
  5. local term = requrie("term")
  6.  
  7. local stored = cellgetEnergyStored()/80000000
  8. local turnOn = 0.1
  9. local turnOff = 0.9
  10.  
  11. local _,y = term.getCursor()
  12.  
  13. local function PowerSupply()
  14. if stored <= turnOn and rs.getOutput(sides.left) == 0 then
  15. rs.setOutput(sides.left,15)
  16. elseif stored >= turn off and rs.getOutput(sides.left) == 15 then
  17. rs.setOutput(sides.left,0)
  18. end
  19.  
  20.  
  21. local state
  22. if rs.getOutput(sides.left) == 15 then
  23. state = "On"
  24. else
  25. state = "Off"
  26. end
  27.  
  28. term.setCursor(1,y)
  29. term.clearLine()
  30. term.write("Generator state: "..state.."\n")
  31. term.clearLine()
  32. term.write("Stored Energy: "..stored*80000000.."\n")
  33. term.clearLine()
  34. term.write("Energy Percentage: "..stored.."\n")
  35.  
  36. end
  37.  
  38.  
  39. while true do
  40. PowerSupply()
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement