Advertisement
SemlerPDX

Stationeers Custom Multi-Airlock Example

Feb 7th, 2025 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | Gaming | 0 0
  1. #Fast Dual-Type Airlock Control Script v7
  2. # by SemlerPDX Nov2023/Feb2025
  3. # glass doors (East) and composite doors (West)
  4.  
  5. #This style Airlock system expects dedicated active
  6. # vents for each phase of the cycle:
  7. # (Vent out to World) (Vent out to Base) (Vent in from Base)
  8. # Doors should be pre-set to Logic Mode (1)
  9. # Active Vents should also be pre-set to appropriate mode respectively
  10.  
  11. # === Stack Loading Section ===
  12. define GlassDoors -324331872 #(change as needed per airlock)
  13. define CompositeDoors -793837322 #(change as needed per airlock)
  14. define Lights 797794350 #long thin (change as needed)
  15.  
  16. move sp 0
  17. push HASH("VentMarsWest")
  18. push HASH("VentOutWest")
  19. push HASH("VentInWest")
  20. push HASH("PowerStationWest") #this airlock light & gas sensor name
  21. push Lights #this airlock light type
  22. push HASH("Airlock West") #DoorOutWest
  23. push HASH("Power Station") #DoorInWest
  24. push CompositeDoors
  25. push HASH("VentMarsEast")
  26. push HASH("VentOutEast")
  27. push HASH("VentInEast")
  28. push HASH("PowerStationEast") #this airlock light & gas sensor name
  29. push Lights #this airlock light type
  30. push HASH("DoorOutEast")
  31. push HASH("DoorInEast")
  32. push GlassDoors
  33. s db Setting sp
  34. #(these are just example device names above, from my Power Station)
  35. # Stack loading section above could be on a different script to fit more lines
  36. # -just export the stack loader script, run it, then export control script
  37.  
  38.  
  39. # === Airlock Control Section ===
  40. define ActiveVents -1129453144
  41. define GasSensors -1252983604
  42. define SensorIn HASH("GasSensorIn")
  43.  
  44. alias ThisDoor r3
  45. alias ThisVent r4
  46. alias FirstDoor r5
  47. alias SecondDoor r6
  48. alias ThisVentMars r7
  49. alias ThisVentOut r8
  50. alias ThisVentIn r9
  51. alias ThisAirlock r10
  52. alias ThisLightType r11
  53. alias ThisDoorOut r12
  54. alias ThisDoorIn r13
  55. alias ThisDoorType r14
  56. alias STACK r15
  57.  
  58. define PressureMin 15 #kPa (for CanAirlock)
  59. l STACK db Setting
  60.  
  61. start:
  62. move sp STACK
  63. yield
  64. checkAirlocks:
  65. pop ThisDoorType
  66. pop ThisDoorIn
  67. pop ThisDoorOut
  68. pop ThisLightType
  69. pop ThisAirlock
  70. pop ThisVentIn
  71. pop ThisVentOut
  72. pop ThisVentMars
  73. move ThisDoor ThisDoorIn
  74. jal checkDoors #check interior door
  75. move ThisDoor ThisDoorOut
  76. jal checkDoors #check exterior door
  77. bge sp 8 checkAirlocks
  78. j start
  79.  
  80.  
  81. checkDoors:
  82. lbn r0 ThisDoorType ThisDoor Setting Maximum
  83. lbn r1 ThisDoorType ThisDoor Open Maximum
  84. beq r0 r1 ra
  85.  
  86. #Check the Outer Door to determine which direction to cycle
  87. lbn r0 ThisDoorType ThisDoorOut Open Maximum
  88. select ThisVent r0 ThisVentMars ThisVentOut
  89. select FirstDoor r0 ThisDoorOut ThisDoorIn
  90. select SecondDoor r0 ThisDoorIn ThisDoorOut
  91.  
  92. #Cycle this Airlock (or just the doors)
  93. sbn ThisDoorType FirstDoor Open 0
  94. sbn ThisLightType ThisAirlock On 1
  95. sleep 1
  96.  
  97. #Check if we CAN cycle the airlock, or just the doors
  98. lbn r0 GasSensors SensorIn Pressure Average
  99. blt r0 PressureMin cycleComplete
  100.  
  101. #A simple sub-loop to de-pressurize the Airlock
  102. sbn ActiveVents ThisVent On 1
  103. yield
  104. lbn r0 GasSensors ThisAirlock Pressure Maximum
  105. brgtz r0 -2
  106. sleep 1
  107. sbn ActiveVents ThisVent On 0
  108. beq ThisVent ThisVentOut cycleComplete
  109.  
  110. #A simple sub-loop to pressurize the Airlock
  111. sbn ActiveVents ThisVentIn On 1
  112. yield
  113. lbn r0 GasSensors ThisAirlock Pressure Maximum
  114. lbn r1 GasSensors SensorIn Pressure Average
  115. sub r1 r1 5
  116. brlt r0 r1 -4
  117. sbn ActiveVents ThisVentIn On 0
  118.  
  119. cycleComplete:
  120. sbn ThisDoorType SecondDoor Open 1
  121. sbn ThisLightType ThisAirlock On 0
  122. j start
  123.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement