Guest User

reactor temp openccsensors

a guest
Dec 13th, 2012
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.01 KB | None | 0 0
  1. local sensor = peripheral.wrap("back")
  2. -- get basic details of the targets the sensor has detected
  3. local count = 0
  4. sale="right"
  5. --position start stop reactor signal
  6.  
  7. repeat
  8. --reactor cord -1 0 1
  9. local details = sensor.getTargetDetails("-1,0,1")
  10. --for wire
  11. --cable cord 0 -1 1
  12. local CABLE = sensor.getTargetDetails("0,-1,1")
  13. --mfsu cord 2 -1 1
  14. local MFSU = sensor.getTargetDetails("2,-1,1")
  15. sleep(1)
  16. -- 1 sec = 20 (for me) not lineal value
  17. local MABLE = sensor.getTargetDetails("0,-1,1")
  18. local NFSU = sensor.getTargetDetails("2,-1,1")
  19.  
  20. -- EU for wire
  21. SALIDA = (tonumber(MABLE.EnergyConducted ) - tonumber(CABLE.EnergyConducted))/20
  22. MFLIDA = (tonumber(NFSU.EnergyConducted ) - tonumber(MFSU.EnergyConducted))/20
  23. -- EU for mfsu
  24. local menor = tonumber(8500)
  25. -- temp cut off
  26.  
  27. term.clear()
  28. oldx, oldy = term.getCursorPos()
  29. term.setCursorPos(oldx,1)
  30.  
  31.  
  32. print("---------------------")
  33. local AbaJo = tonumber(details.Heat)
  34. if AbaJo <= menor then
  35. --  print("es menor")
  36.     print("Reactor Encendido")
  37.     redstone.setOutput(sale, true)
  38.     local ENLINEA = 1
  39.     else
  40. --  print("es mayor")
  41.     print("Reactor Apagado")
  42.     print("Se alcanzo temperatura critica")
  43.     redstone.setOutput(sale, false)
  44.     local ENLINEA = 0
  45. end
  46.  
  47. print("---------------------")
  48. print("Temperatura: "..tostring(details.Heat).." MAX: "..tostring(details.MaxHeat))
  49. print("Salida wire: "..SALIDA.." EU/t")
  50. print("Total      : "..MABLE.EnergyConducted.." EU")
  51. print("Salida NFSU: "..MFLIDA.." EU/t para MAX "..NFSU.Output)
  52. print("Total      : "..NFSU.EnergyConducted.." EU")
  53. print("Almacenado : "..NFSU.Stored.." / "..NFSU.Capacity)
  54. count = count + 1
  55.  
  56. if count == 600 then
  57.         redstone.setOutput(sale, false)
  58.         sleep(1)
  59.         redstone.setOutput(sale, true)
  60.         local count = 0
  61. end
  62.  
  63. print("---------------------")
  64.  
  65. if SALIDA == 0 then
  66.         print("-SIN-CARGA-ESPERANDO-")
  67.         print("---------------------")
  68.         if ENLINEA == 1 then
  69.             redstone.setOutput(sale, false)
  70.             sleep(20)
  71.             redstone.setOutput(sale, true)
  72.         end
  73. end
  74.  
  75.  
  76. sleep(1)
  77.  
  78. until proces_kill
Advertisement
Add Comment
Please, Sign In to add comment