SemlerPDX

Stationeers Custom Multi-Airlock Example

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