Glitchies

Untitled

Mar 30th, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. cell1 = peripheral.wrap("cofh_thermalexpansion_energycell_0")
  2. cell2 = peripheral.wrap("cofh_thermalexpansion_energycell_1")
  3.  
  4. function off()
  5. percent()
  6. redstone.setOutput("back", false)
  7. if cellpercent < 150 then
  8. print(tonumber(cellpercent).."%")
  9. sleep(20)
  10. percent()
  11. end
  12. end
  13.  
  14. function on()
  15. percent()
  16. while cellpercent < 195 do
  17. print(tonumber(cellpercent).."%")
  18. redstone.setOutput("back", false)
  19. sleep(20)
  20. percent()
  21. end
  22. redstone.setOutput("back", true)
  23. end
  24.  
  25. function poke()
  26. cell1Stored = cell1.getEnergyStored("cofh_thermalexpansion_energycell_0")
  27. cell1Full = cell1.getMaxEnergyStored("cofh_thermalexpansion_energycell_0")
  28. cell2Stored = cell2.getEnergyStored("cofh_thermalexpansion_energycell_1")
  29. cell2Full = cell2.getMaxEnergyStored("cofh_thermalexpansion_energycell_1")
  30. cell1Percent = math.floor(100*cell1Stored/cell1Full)
  31. cell2Percent = math.floor(100*cell2Stored/cell2Full)
  32. end
  33.  
  34. function percent()
  35. poke()
  36. cellpercent = cell1Percent + cell2Percent
  37. end
  38.  
  39. while true do
  40. on()
  41. --off()
  42. --percent()
  43. print("sleeping...")
  44. sleep(5)
  45. end
Advertisement
Add Comment
Please, Sign In to add comment