Advertisement
Guest User

reaktor

a guest
Aug 22nd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 KB | None | 0 0
  1. print("Input Gate")
  2. local gate_input = read()
  3. gate_input = "flux_gate_6"
  4. local input = peripheral.wrap(gate_input)
  5. if input==nil then
  6.     error("Gate not found")
  7. end
  8. print("Output Gate")
  9. local gate_output = read()
  10. gate_output = "flux_gate_7"
  11. local output = peripheral.wrap(gate_output)
  12. if output==nil then
  13.     error("Gate not found")
  14. end
  15. local reactor = peripheral.find("draconic_reactor")
  16. if reactor==nil then
  17.     error("no reactor connected to network")
  18. end
  19. input.setOverrideEnabled(true)
  20. output.setOverrideEnabled(true)
  21. output.setFlowOverride(0)
  22. input.setFlowOverride(1000000)
  23. reactor.chargeReactor()
  24. print("Charging")
  25. while reactor.activateReactor()==false do
  26.     os.sleep(1)
  27.     write(".")
  28. end
  29. input.setFlowOverride(10000)
  30. print("Charging complete")
  31. os.sleep(0.2)
  32. print("press Enter to start")
  33. read()
  34. print("reactor starting")
  35. local fieldperc
  36. abwsum = 0
  37. while 1==1 do
  38.     info = reactor.getReactorInfo()
  39.     fieldperc = info.fieldStrength/info.maxFieldStrength
  40.     abw = - fieldperc + 0.3
  41.     abwsum = abwsum + abw
  42.     xe = abw*10000 + abwsum*10000
  43.     if xe<0 then abwsum =0 end
  44.     temp = info.temperature
  45.     abwt = 7000 - temp
  46.     abwsumt = abwsum + abw
  47.     xet = 300000
  48.     if abw<0.1 then
  49.         xet = abw + abwsum
  50.     end
  51.     output.setFlowOverride(xet)
  52.     input.setFlowOverride(xe+1000)
  53.     os.sleep(0.1)
  54.     print(input.getFlow())
  55.     print(abwt)
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement