Advertisement
Senpasi

Stationeers - Airlock Gates IC code

Jan 3rd, 2021 (edited)
2,686
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #============== GateDoor AirLock ==================#
  2. #                  by Senpasi                      #
  3. #                  based on AirLock ICS by swagman #
  4. # schema - https://yadi.sk/i/4CB5KBejq0uCpw        #
  5. #===================================== 13.01.2021 =#
  6. define pressLeft 0  #outer (Vent0) pressure set 0 kPa
  7. define pressRight 50 #inner (Vent1) pressure set 50 kPa
  8.  
  9. alias DoorLeft d0 # memory -> batch writer "Open" to outer gates
  10. alias ButtonsLeft d1 # logic "max" from buttons on outer gates
  11. #alias GSens d2 # replace it by command lb
  12. alias DoorRight d3 # memory -> batch writer "Open" to inner gates
  13. alias ButtonsRight d4 # logic "max" from buttons on inner gates
  14. alias Vent d5 # memory, vent modes. 0 - off, 1 - vacuuming to outer, 2 - pressurize from inner, -1 - pressurize from outer, -2 - vacuuming to inner.
  15. #you need 3 constants in memory units - 0, 1 and 2
  16. #choose vent mode with 2 compare units >0 (out) and <0 (in),
  17. #choose vent on/off with unary math unit "abs" then 2 compare units (1 for outer and 2 for inner network)
  18.  
  19. alias state r15
  20. alias route r14
  21. alias press r13 #current pressure
  22. alias targp r12 #target pressure
  23. alias btrev r11 #button revers direction
  24. alias btpas r10 #button pass direction
  25.  
  26. move state st1 #init state for first loop
  27.  
  28. loop:#--main loop
  29. yield
  30. select targp route pressLeft pressRight
  31. select r9 route 0 3 #DoorLeft DoorRight - door for open after pressurize
  32. select r8 route 3 0 #DoorRight DoorLeft - door for close before vacuuming
  33. select r5 route 1 4 #ButtonsLeft ButtonsRight - door for open after pressurize
  34. select r4 route 4 1 #ButtonsRight ButtonsLeft - door for close before vacuuming
  35. select r6 route -2 1 #Vent mode - vacuuming
  36. select r7 route -1 2 #Vent mode - pressurize
  37. #l press GSens Setting
  38. lb press -1252983604 Pressure 0
  39. l btpas dr5 Setting
  40. l btrev dr4 Setting
  41. s db Setting state #debug
  42. j state
  43.  
  44. st1: #--door opened
  45. l r0 DoorLeft Setting
  46. l route DoorRight Setting
  47. xor r0 route r0
  48. beqz r0 end #simultaneous access, goto end
  49. beqz btpas end #door is allready opened, goto end
  50. s dr8 Setting 0 #close door
  51. move state st2 #start vacuuming
  52. j end
  53.  
  54. st2: #--vacuuming
  55. xor route route btrev #person change mind
  56. select state btrev st3 st2
  57. sgtz r0 press
  58. select r6 r0 r6 0 #if vacuum set mode=0
  59. s Vent Setting r6
  60. select state r0 state st3
  61. j end
  62.  
  63. st3: #--pressurize
  64. xor route route btrev #person change mind
  65. select state btrev st2 st3
  66. slt r0 press targp
  67. select r0 btpas 0 r0
  68. select r7 r0 r7 0 #if pressurized set mode=0
  69. s Vent Setting r7
  70. bgtz r0 end
  71. s dr9 Setting 1
  72. xor route route 1
  73. move state st1
  74. end:#--airlock
  75.  
  76. j loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement