Advertisement
Guest User

startup

a guest
Dec 11th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.54 KB | None | 0 0
  1.  local TurbineA
  2.  local TurbineB
  3.  local TurbineC
  4.  local TurbineP
  5.  local TurbineO
  6.  local Reactor
  7.  local energy
  8.  local max
  9.  local perc
  10.  local ReactorActive
  11.  
  12.  local TurbineA = peripheral.wrap("BigReactors-Turbine_5")
  13.  local TurbineB = peripheral.wrap("BigReactors-Turbine_6")
  14.  local TurbineP = peripheral.wrap("BigReactors-Turbine_7")
  15.  local TurbineO = peripheral.wrap("BigReactors-Turbine_8")
  16.  local TurbineC = peripheral.wrap("BigReactors-Turbine_9")
  17.  
  18.  local Reactor = peripheral.wrap("BigReactors-Reactor_4")
  19.  
  20. rednet.open("back")
  21.  
  22.  
  23.  while true do
  24.  
  25. term.clear()
  26. term.setCursorPos(1,1)
  27.  
  28.  
  29. --Empfangene Nachricht
  30.  
  31.  local senderId, message, protocol = rednet.receive(EnergyCore)
  32.  energy = message
  33.  print("Derzeitiges Energylevel: ", energy)
  34.  
  35.  local senderId, message, protocol = rednet.receive(EnergyCore)
  36.  max = message
  37.  print("Maximum speicherbarer Energie: ", max)
  38.  
  39.  
  40.  
  41. --Wie voll ist der Reactor
  42.  
  43.   perc = (math.floor(((energy*100)/max)))
  44.   print()
  45.   print ("Derzeitige % gespeicherter Energie: ",perc)
  46.  
  47. --Signal an die Turbinen und Ractoren
  48.  
  49. if perc==100 then
  50.  TurbineA.setActive(false)
  51.  TurbineB.setActive(false)
  52.  TurbineC.setActive(false)
  53.  TurbineP.setActive(false)
  54.  TurbineO.setActive(false)
  55.  Reactor.setAllControlRodLevels(100) end
  56.  
  57. if perc>=95 and perc<100 then
  58.  TurbineA.setActive(true)
  59.  TurbineB.setActive(false)
  60.  TurbineC.setActive(false)
  61.  TurbineP.setActive(false)
  62.  TurbineO.setActive(false)
  63.  Reactor.setAllControlRodLevels(91) end
  64.  
  65. if perc>=90 and perc<=94 then
  66.  TurbineA.setActive(true)
  67.  TurbineB.setActive(true)
  68.  TurbineC.setActive(false)
  69.  TurbineP.setActive(false)
  70.  TurbineO.setActive(false)
  71.  Reactor.setAllControlRodLevels(82) end
  72.  
  73. if perc>=85 and perc<=89 then
  74.  TurbineA.setActive(true)
  75.  TurbineB.setActive(true)
  76.  TurbineC.setActive(true)
  77.  TurbineP.setActive(false)
  78.  TurbineO.setActive(false)
  79.  Reactor.setAllControlRodLevels(73) end
  80.  
  81. if perc>=80 and perc<=84 then
  82.  TurbineA.setActive(true)
  83.  TurbineB.setActive(true)
  84.  TurbineC.setActive(true)
  85.  TurbineP.setActive(true)
  86.  TurbineO.setActive(false)
  87.  Reactor.setAllControlRodLevels(65) end
  88.  
  89. if perc>=75 and perc<=79 then
  90.  TurbineA.setActive(true)
  91.  TurbineB.setActive(true)
  92.  TurbineC.setActive(true)
  93.  TurbineP.setActive(true)
  94.  TurbineO.setActive(true)
  95.  Reactor.setAllControlRodLevels(56) end
  96.  
  97. if perc<=15 then
  98.  TurbineA.setActive(true)
  99.  TurbineB.setActive(true)
  100.  TurbineC.setActive(true)
  101.  TurbineP.setActive(true)
  102.  TurbineO.setActive(true)
  103.  Reactor.setAllControlRodLevels(56) end
  104.  
  105.  
  106.  
  107. --SchlussSatz
  108. sleep(3)
  109.  
  110. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement