Advertisement
djgauth

CellControl

Oct 21st, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. --BatterieGestion
  2. --By DJGauth
  3. --Placez le computer sous la cell
  4. --Cell Mekanism
  5.  
  6.  
  7. --Veuillez donner ID du computer
  8. IDC = 1
  9.  
  10. c = peripheral.wrap("top")
  11.  
  12. --Variable
  13. energyStored = 0
  14. h = 2
  15. d = os.day()
  16. tn = os.time()
  17. activ = false
  18. force = false
  19.  
  20. fonction time()
  21. t = textutils.formatTime(t,false)
  22. end
  23.  
  24. function text()
  25. term.clear()
  26. term.setTextColor(colors.yellow)
  27. term.setCursorPos(1,16)
  28. term.write("Cell CONTROLLER")
  29. term.setTextColor(colors.white)
  30. end
  31.  
  32. function ligne()
  33. term.setCursorPos(1,h)
  34. term.write("Energy stored: "..energyStored)
  35. h=h+1
  36. end
  37.  
  38. function affTime()
  39.  term.setCursorPos(1,h)
  40.  term.write("Dernière actualisation le: "..d.." a: "..t)
  41.  h = h + 1
  42. end
  43.  
  44. --Prog
  45. text()
  46.  
  47. while true do
  48.  energyStored = c.getStored()
  49.  
  50.  ligne()
  51.  time()
  52.  affTime()
  53.  
  54.  if energyStored < 100000 or force == true then
  55.   redstone.setOutput("top", false)
  56.   activ = false
  57.  else
  58.   activ = true
  59.   redstone.setOutput("top", true)
  60.  end
  61.  
  62.  sleep(10)
  63.  
  64.  force = redstone.getInput("right")
  65.  
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement