Advertisement
Guest User

Untitled

a guest
Oct 24th, 2015
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 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 function PowerSupply()
  12. if stored <= turnOn and rs.getOutput(sides.left) == 0 then
  13. rs.setOutput(sides.left,15)
  14. elseif stored >= turn off and rs.getOutput(sides.left) == 15 then
  15. rs.setOutput(sides.left,0)
  16. end
  17.  
  18.  
  19. local state
  20. if rs.getOutput(sides.left) == 15 then
  21. state = "On"
  22. else
  23. state = "Off"
  24. end
  25.  
  26.  
  27. term.clearLine()
  28. term.write("Generator state: "..state.."\n")
  29. term.clearLine()
  30. term.write("Stored Energy: "..stored*80000000.."\n")
  31. term.clearLine()
  32. term.write("Energy Percentage: "..stored.."\n")
  33.  
  34. end
  35.  
  36.  
  37. while true do
  38. PowerSupply()
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement