Ledger Nano X - The secure hardware wallet
SHARE
TWEET

PTNCR1

a guest Apr 7th, 2020 190 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  --Pulse Thermal Nuclear Reactor Control System
  2. --by 0xShellcode (known in game as Mr_Athans)
  3. --Pastebin New:
  4. --Pastebin old: https://pastebin.com/ADVmKVeY
  5.  ----------------------------
  6.  
  7. local rupsd = false     --reactor user power switch detect
  8. local rpp = false       --reactor primary power
  9. local pssd = false      --power suppy signal detect
  10.  
  11. local tm1sd = false     --thermal monitor 1 signal detect
  12. local tm2sd = false     --thermal monitor 2 signal detect
  13. local tm3sd = false     --thermal monitor 3 signal detect
  14. local tm4sd = false     --thermal monitor 4 signal detect
  15.  
  16. local cs1 = false       --coolant set 1 signal
  17. local cs2 = false       --coolant set 2 signal
  18. local cs3 = false       --coolant set 3 signal
  19. local cs4 = false       --coolant set 4 signal
  20. local clv = false       --coolant lock valves
  21.  
  22. local tmlpd = false     --thermal monitor low power detect
  23. local tmbp1 = false     --thermal monitor backup power 1 signal
  24. local tmbp2 = false     --thermal monitor backup power 2 signal
  25. local dwrfs = false     --distilled water refill system signal
  26.  
  27. local cycle = 0             --reactor start cycle
  28. local seconds = 60          --reactor startup length
  29. local startcycle = 0        --reactor startup cycle
  30. local startuptimer = false  --reactor startup timer
  31. local powerdown = true      --reactor - powerdown state
  32. local cooldown = false      --reactor - cooldown state
  33. local shutdown = false      --reactor - shutdown state
  34.  
  35. local cableSide = "bottom"  --bundled cable input side
  36.  
  37. mon = peripheral.wrap("top")            --monitor output side
  38. mon.restore = term.current()            --set current built-in monitor to mon.restore
  39. mon.setCursorPos(1,1)                   --set cursor position to top left
  40. mon.setTextScale(.5)                    --change text scale to small
  41. term.redirect(mon)                      --redirects screen output to mon
  42. redstone.setBundledOutput (cableSide, 0) --disables all output signals from computer before starting loop
  43.  
  44. while true do
  45.  print("Pulse Thermal Nuclear Reactor 1 Control - Cycle ", cycle)
  46.  
  47.  --Reactor User Power Switch Detect
  48.  if colors.test (redstone.getBundledInput(cableSide), colors.cyan) then
  49.   print("    Reactor User Power Switch        - Enabled")
  50.   rupsd = true
  51.  else
  52.   print("    Reactor User Power Switch        - Disabled")
  53.   rupsd = false
  54.  end
  55.  
  56.  --Reactor Primary Power On/Off
  57.  if colors.test (redstone.getBundledInput(cableSide), colors.white) then
  58.   print("    Reactor Powered-On Status        - On")
  59.   rpp = true
  60.  else
  61.   print("    Reactor Powered-On Status        - Off")
  62.   rpp = false
  63.  end
  64.  
  65.  --Power Storage Full Signal Detect
  66.  if colors.test (redstone.getBundledInput(cableSide), colors.brown) then
  67.   print("    Power Storage Capacity Full      - Yes", "\n")
  68.   pssd = true
  69.  else
  70.   print("    Power Storage Capacity Full      - No", "\n")
  71.   pssd = false
  72.  end
  73.  
  74.  --Thermal Monitor 1 Signal Detect
  75.  if colors.test (redstone.getBundledInput(cableSide), colors.purple) then
  76.   print("    Thermal Monitor 1 Detection      - On")
  77.   tm1sd = true
  78.  else
  79.   print("    Thermal Monitor 1 Detection      - Off")
  80.   tm1sd = false
  81.  end
  82.  
  83.  --Thermal Monitor 2 Signal Detect
  84.  if colors.test (redstone.getBundledInput(cableSide), colors.blue) then
  85.   print("    Thermal Monitor 2 Detection      - On")
  86.   tm2sd = true
  87.  else
  88.   print("    Thermal Monitor 2 Detection      - Off")
  89.   tm2sd = false
  90.  end
  91.  
  92.  --Thermal Monitor 3 Signal Detect
  93.  if colors.test (redstone.getBundledInput(cableSide), colors.lime) then
  94.   print("    Thermal Monitor 3 Detection      - On")
  95.   tm3sd = true
  96.  else
  97.   print("    Thermal Monitor 3 Detection      - Off")
  98.   tm3sd = false
  99.  end
  100.  
  101.  --Thermal Monitor 4 Signal Detect
  102.  if colors.test (redstone.getBundledInput(cableSide), colors.yellow) then
  103.   print("    Thermal Monitor 4 Detection      - On (Shutdown)", "\n")
  104.   tm4sd = true
  105.  else
  106.   print("    Thermal Monitor 4 Detection      - Off", "\n")
  107.   tm4sd = false
  108.  end
  109.  
  110.  ----------------------------
  111.  
  112.  --Coolant Set 1 On/Off Detect
  113.  if colors.test (redstone.getBundledInput(cableSide), colors.pink) then
  114.   print("    Coolant System 1                 - On")
  115.   cs1 = true
  116.  else
  117.   print("    Coolant System 1                 - Off")
  118.   cs1 = false
  119.  end
  120.  
  121.  --Coolant Set 2 On/Off Detect
  122.  if colors.test (redstone.getBundledInput(cableSide), colors.red) then
  123.   print("    Coolant System 2                 - On")
  124.   cs2 = true
  125.  else
  126.   print("    Coolant System 2                 - Off")
  127.   cs2 = false
  128.  end
  129.  
  130.  --Coolant Set 3 On/Off Detect
  131.  if colors.test (redstone.getBundledInput(cableSide), colors.orange) then
  132.   print("    Coolant System 3                 - On")
  133.   cs3 = true
  134.  else
  135.   print("    Coolant System 3                 - Off")
  136.   cs3 = false
  137.  end
  138.  
  139.  --Coolant Set 4 On/Off Detect
  140.  if colors.test (redstone.getBundledInput(cableSide), colors.black) then
  141.   print("    Coolant System 4                 - On")
  142.   cs4 = true
  143.  else
  144.   print("    Coolant System 4                 - Off")
  145.   cs4 = false
  146.  end
  147.  
  148.  --Coolant Lock Valves (Hot coolant side next to heat exchangers)
  149.  if colors.test (redstone.getBundledInput(cableSide), colors.lightBlue) then
  150.   print("    Coolant Lock Valves              - Open", "\n")
  151.   clv = true
  152.  else
  153.   if (startuptimer==true) then
  154.    print("    Coolant Lock Valves              - Closed ", startcycle, "/", (seconds*4), "\n")
  155.   elseif (startuptimer==false) then
  156.    print("    Coolant Lock Valves              - Closed", "\n")
  157.   end
  158.   clv = false
  159.  end
  160.  
  161.  ----------------------------
  162.  
  163.  --Thermal Monitor Low Power Detect
  164.  if colors.test (redstone.getBundledInput(cableSide), colors.green) then
  165.   print("    Thermal Monitor Low Power        - Yes")
  166.   tmlpd = true
  167.  else
  168.   print("    Thermal Monitor Low Power        - No")
  169.   tmlpd = false
  170.  end
  171.  
  172.  --Thermal Monitor Backup Power 1 On/Off
  173.  if colors.test (redstone.getBundledInput(cableSide), colors.magenta) then
  174.   print("    Thermal Monitor Backup Power 1   - On")
  175.   tmbp1 = true
  176.  else
  177.   print("    Thermal Monitor Backup Power 1   - Off")
  178.   tmbp1 = false
  179.  end
  180.  
  181.  --Thermal Monitor Backup Power 2 On/Off
  182.  if colors.test (redstone.getBundledInput(cableSide), colors.gray) then
  183.   print("    Thermal Monitor Backup Power 2   - On")
  184.   tmbp2 = true
  185.  else
  186.   print("    Thermal Monitor Backup Power 2   - Off")
  187.   tmbp2 = false
  188.  end
  189.  
  190.  --Distilled Water Refill System On/Off
  191.  if colors.test (redstone.getBundledInput(cableSide), colors.lightGray) then
  192.   print("    Distilled Water Refill System    - On", "\n")
  193.   dwrfs = true
  194.  else
  195.   print("    Distilled Water Refill System    - Off", "\n")
  196.   dwrfs = false
  197.  end
  198.  
  199.  ----------------------------
  200.  
  201.  --Reactor Power On and Cooldown Logic
  202.  
  203.  local run = false
  204.  
  205.  --Thermal Monitor Cooldown and Shutdown Logic --
  206.  if (tm2sd==false) and (shutdown==false) then
  207.   cooldown = false
  208.  end
  209.  
  210.  if (tm3sd==true) then
  211.   cooldown = true
  212.  end
  213.  
  214.  if (tm4sd==true) then
  215.   shutdown = true
  216.  end
  217.  
  218.  --Control Logic --
  219.  if (rupsd==true) and (cooldown==false) and (shutdown==false) and (pssd==false) then --if Reactor User Power Switch enabled, cooldown off, shutdown off, and power supply not full power on reactor
  220.   print("      Reactor Powered-On:    Generating Thermal Power")
  221.   run = true
  222.  elseif (rupsd==true) and (cooldown==true) and (shutdown==false) and (pssd==false) then
  223.   print("      Reactor Powered-On:    Maintaining Thermal Power")
  224.   run = true
  225.  elseif (pssd==true) then
  226.   print("      Run condition fault:   Power Supply is Full")
  227.   run = false
  228.  elseif (shutdown==true) then
  229.   print("      Reactor Powered-Off:   Shutdown Temp Triggered")
  230.   shutdown = true
  231.   run = false
  232.  else
  233.   print("      Reactor Powered-Off:   User Disabled")
  234.   redstone.setBundledOutput (cableSide, 0)
  235.   run = false
  236.  end
  237.  
  238.  --Run Logic --
  239.  if (run==true) then
  240.   --Coolant Lock Valves Timer Trigger
  241.   if (powerdown==true) then  
  242.    startuptimer = true
  243.    powerdown = false
  244.   end
  245.   --Coolant Lock Values Timer Logic
  246.   if (startuptimer==true) and (startcycle <= (seconds * 4)) then
  247.    startcycle = startcycle + 1
  248.    clv = false
  249.   elseif (startuptimer==true) and (startcycle > (seconds * 4)) then
  250.    startuptimer = false
  251.    startcycle = 0
  252.    clv = true
  253.   elseif (startuptimer==false) then
  254.    startuptimer = false
  255.    startcycle = 0
  256.    clv = true
  257.   end
  258.   --Reactor State and output to multiple colors
  259.   if (cooldown==false) then
  260.    print("      Reactor State:         Increasing Thermal Power")
  261.    if (clv==true) then
  262.     redstone.setBundledOutput (cableSide, colors.combine(colors.white, colors.pink, colors.red, colors.orange, colors.black, colors.lightBlue))
  263.    else
  264.     redstone.setBundledOutput (cableSide, colors.combine(colors.white, colors.pink, colors.red, colors.orange, colors.black))
  265.    end
  266.    powerdown = false
  267.   elseif (cooldown==true) then
  268.    print("      Reactor State:         Decreasing Thermal Power")
  269.    if (clv==true) then
  270.     redstone.setBundledOutput (cableSide, colors.combine(colors.pink, colors.red, colors.orange, colors.black, colors.lightBlue))
  271.    else
  272.     redstone.setBundledOutput (cableSide, colors.combine(colors.pink, colors.red, colors.orange, colors.black))
  273.    end
  274.    powerdown = false
  275.   end
  276.  else -- run = false
  277.   if (shutdown==true) then
  278.    print("      Reactor State:         Shutdown Triggered, Reset Reactor")
  279.    redstone.setBundledOutput (cableSide, 0)
  280.    powerdown = true
  281.    startuptimer = false
  282.    startcycle = 0
  283.   elseif (pssd==true) then
  284.    print("      Reactor State:         Power Capacity Full")
  285.    redstone.setBundledOutput (cableSide, 0)
  286.    powerdown = true
  287.    startuptimer = false
  288.    startcycle = 0
  289.   else
  290.    print("      Reactor State:         Reactor Powered-Down")
  291.    powerdown = true
  292.    startuptimer = false
  293.    startcycle = 0
  294.   end
  295.  end
  296.  
  297.  ---------------------------------
  298.  
  299.  cycle = cycle + 1
  300.  os.sleep(.25)
  301.  term.clear()
  302.  term.setCursorPos(1,1)
  303. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top