Actions

Difference between revisions of "Custom Airlock IC10"

From Unofficial Stationeers Wiki

(Use proper/better category -> IC10)
m (removed unecessary <br> tags)
 
(2 intermediate revisions by the same user not shown)
Line 40: Line 40:
 
{| class="mw-collapsible mw-collapsed"
 
{| class="mw-collapsible mw-collapsed"
 
!Source code:
 
!Source code:
 +
|-
 +
|
 +
{{ICCode|
 +
define Int.Pressure 100
 +
define Ext.Pressure 0
 +
 +
alias Int.Door d0
 +
alias Ext.Door d1
 +
alias Int.Vent d2
 +
alias Ext.Vent d3
 +
alias Sensor d4
 +
alias LedLight d5
 +
 +
define Color.Red 4
 +
define Color.Yellow 5
 +
define Color.Green 2
 +
define Mode.Out 1
 +
define Mode.In 0
 +
 +
alias rT r0
 +
alias rT2 r1
 +
alias rTarPressure r2
  
|-
+
Init:
|<br>
+
s Int.Vent On 0
define Int.Pressure 100<br>
+
s Ext.Vent On 0
define Ext.Pressure 0<br>
+
s Ext.Door Mode 1 #Logic mode
<br>
+
s Int.Door Mode 1 #Logic mode
alias Int.Door d0<br>
+
s LedLight Color Color.Green
alias Ext.Door d1<br>
+
s LedLight On 1
alias Int.Vent d2<br>
+
s Int.Door Open 0
alias Ext.Vent d3<br>
+
s Ext.Door Open 1
alias Sensor d4<br>
+
yield
alias LedLight d5<br>
+
 
<br>
+
main:
define Color.Red 4<br>
+
jal _monitorTrigger
define Color.Yellow 5<br>
+
jal _cycleToInt
define Color.Green 2<br>
+
jal _monitorTrigger
define Mode.Out 1<br>
+
jal _cycleToExt
define Mode.In 0<br>
+
j main
<br>
+
 
alias rT r0<br>
+
_cycleToInt:
alias rT2 r1<br>
+
push ra
alias rTarPressure r2<br>
+
s Ext.Door Lock 1
<br>
+
s Int.Door Lock 1
Init:<br>
+
s Ext.Door Open 0
s Int.Vent On 0<br>
+
s Ext.Vent Mode Mode.Out
s Ext.Vent On 0<br>
+
s Ext.Vent On 1
s Ext.Door Mode 1 #Logic mode<br>
+
s LedLight Color Color.Red
s Int.Door Mode 1 #Logic mode<br>
+
s LedLight On 1
s LedLight Color Color.Green<br>
+
jal _dePressurize
s LedLight On 1<br>
+
s Ext.Vent On 0
s Int.Door Open 0<br>
+
s Int.Vent Mode Mode.In
s Ext.Door Open 1<br>
+
s Int.Vent PressureExternal Int.Pressure
yield<br>
+
move rTarPressure Int.Pressure
<br>
+
s Int.Vent On 1
main:<br>
+
s LedLight Color Color.Yellow
jal _monitorTrigger<br>
+
jal _pressurize
jal _cycleToInt<br>
+
s LedLight Color Color.Green
jal _monitorTrigger<br>
+
s Int.Vent On 0
jal _cycleToExt<br>
+
s Int.Door Open 1
j main<br>
+
s Ext.Door Lock 0
<br>
+
s Int.Door Lock 0
_cycleToInt:<br>
+
pop ra
push ra<br>
+
j ra
s Ext.Door Lock 1<br>
+
 
s Int.Door Lock 1<br>
+
_cycleToExt:
s Ext.Door Open 0<br>
+
push ra
s Ext.Vent Mode Mode.Out<br>
+
s Int.Door Lock 1
s Ext.Vent On 1<br>
+
s Ext.Door Lock 1
s LedLight Color Color.Red<br>
+
s Int.Door Open 0
s LedLight On 1<br>
+
s Int.Vent Mode Mode.Out
jal _dePressurize<br>
+
s Int.Vent On 1
s Ext.Vent On 0<br>
+
s LedLight Color Color.Red
s Int.Vent Mode Mode.In<br>
+
s LedLight On 1
s Int.Vent PressureExternal Int.Pressure<br>
+
jal _dePressurize
move rTarPressure Int.Pressure<br>
+
s Int.Vent On 0
s Int.Vent On 1<br>
+
s Ext.Vent Mode Mode.In
s LedLight Color Color.Yellow<br>
+
s Ext.Vent PressureExternal Ext.Pressure
jal _pressurize<br>
+
move rTarPressure Ext.Pressure
s LedLight Color Color.Green<br>
+
s Ext.Vent On 1
s Int.Vent On 0<br>
+
s LedLight Color Color.Yellow
s Int.Door Open 1<br>
+
jal _pressurize
s Ext.Door Lock 0<br>
+
s LedLight Color Color.Green
s Int.Door Lock 0<br>
+
s Ext.Vent On 0
pop ra<br>
+
s Ext.Door Open 1
j ra<br>
+
s Int.Door Lock 0
<br>
+
s Ext.Door Lock 0
_cycleToExt:<br>
+
pop ra
push ra<br>
+
j ra
s Int.Door Lock 1<br>
+
 
s Ext.Door Lock 1<br>
+
_dePressurize:
s Int.Door Open 0<br>
+
l rT Sensor Pressure
s Int.Vent Mode Mode.Out<br>
+
beqz rT dePressurize_end
s Int.Vent On 1<br>
+
l rT LedLight On
s LedLight Color Color.Red<br>
+
beqz rT dePressurize_end
s LedLight On 1<br>
+
j _dePressurize
jal _dePressurize<br>
+
dePressurize_end:
s Int.Vent On 0<br>
+
s LedLight On 1
s Ext.Vent Mode Mode.In<br>
+
yield
s Ext.Vent PressureExternal Ext.Pressure<br>
+
j ra
move rTarPressure Ext.Pressure<br>
+
 
s Ext.Vent On 1<br>
+
_pressurize:
s LedLight Color Color.Yellow<br>
+
l rT Sensor Pressure
jal _pressurize<br>
+
bge rT rTarPressure pressurize_end
s LedLight Color Color.Green<br>
+
l rT LedLight On
s Ext.Vent On 0<br>
+
beqz rT pressurize_end
s Ext.Door Open 1<br>
+
j _pressurize
s Int.Door Lock 0<br>
+
pressurize_end:
s Ext.Door Lock 0<br>
+
s LedLight On 1
pop ra<br>
+
yield
j ra<br>
+
j ra
<br>
+
 
_dePressurize:<br>
+
_monitorTrigger:
l rT Sensor Pressure<br>
+
l rT Int.Door Setting
beqz rT dePressurize_end<br>
+
l rT2 Ext.Door Setting
l rT LedLight On<br>
+
beq rT rT2 monitorTrigger_end
beqz rT dePressurize_end<br>
+
l rT LedLight On
j _dePressurize<br>
+
beqz rT monitorTrigger_end
dePressurize_end:<br>
+
yield
s LedLight On 1<br>
+
j _monitorTrigger
yield<br>
+
monitorTrigger_end:
j ra<br>
+
yield
<br>
+
j ra
_pressurize:<br>
+
}}
l rT Sensor Pressure<br>
 
bge rT rTarPressure pressurize_end<br>
 
l rT LedLight On<br>
 
beqz rT pressurize_end<br>
 
j _pressurize<br>
 
pressurize_end:<br>
 
s LedLight On 1<br>
 
yield<br>
 
j ra<br>
 
<br>
 
_monitorTrigger:<br>
 
l rT Int.Door Setting<br>
 
l rT2 Ext.Door Setting<br>
 
beq rT rT2 monitorTrigger_end<br>
 
l rT LedLight On<br>
 
beqz rT monitorTrigger_end<br>
 
yield<br>
 
j _monitorTrigger<br>
 
monitorTrigger_end:<br>
 
yield<br>
 
j ra<br>
 
 
|}
 
|}

Latest revision as of 03:39, 20 February 2026

Airlockscreen.jpg

Contents[edit]

This script controls all functions of an airlock that consists of the following:

Assembly[edit]

Set up a standard airlock for atmosphere on both sides. Configure the pressures in the first two lines of the script. Before exporting the script or resetting the IC, make sure the airlock is cycled to the outside (inner door closed, outer open). The LED serves as trigger for both cycling the airlock and skipping each phase, hence should be placed inside the airlock. The airlock should be a single frame to avoid leftover atmosphere after depressurization. For larger airlocks place the sensor on the far side from the vents. The script supports Blast Doors, but since they lack a door handle you will need a button on each side (outside) of the airlock. Connect a Logic Writer to each button and use it to toggle the LED.

IC10 pin layout:

D0 Interior Door
D1 Exterior Door
D2 Interior Vent
D3 Exterior Vent
D4 Gas Sensor
D5 LED Light

Usage[edit]

The airlock can be cycled by interacting with either door, or turning the LED off. During cycling the doors are locked, and the LED can be used to skip both depressurize (red) and pressurize (yellow) phases.

Source Code

Source code:
define Int.Pressure 100
define Ext.Pressure 0

alias Int.Door d0
alias Ext.Door d1
alias Int.Vent d2
alias Ext.Vent d3
alias Sensor d4
alias LedLight d5

define Color.Red 4
define Color.Yellow 5
define Color.Green 2
define Mode.Out 1
define Mode.In 0

alias rT r0
alias rT2 r1
alias rTarPressure r2

Init:
s Int.Vent On 0
s Ext.Vent On 0
s Ext.Door Mode 1 #Logic mode
s Int.Door Mode 1 #Logic mode
s LedLight Color Color.Green
s LedLight On 1
s Int.Door Open 0
s Ext.Door Open 1
yield

main:
jal _monitorTrigger
jal _cycleToInt
jal _monitorTrigger
jal _cycleToExt
j main

_cycleToInt:
push ra
s Ext.Door Lock 1
s Int.Door Lock 1
s Ext.Door Open 0
s Ext.Vent Mode Mode.Out
s Ext.Vent On 1
s LedLight Color Color.Red
s LedLight On 1
jal _dePressurize
s Ext.Vent On 0
s Int.Vent Mode Mode.In
s Int.Vent PressureExternal Int.Pressure
move rTarPressure Int.Pressure
s Int.Vent On 1
s LedLight Color Color.Yellow
jal _pressurize
s LedLight Color Color.Green
s Int.Vent On 0
s Int.Door Open 1
s Ext.Door Lock 0
s Int.Door Lock 0
pop ra
j ra

_cycleToExt:
push ra
s Int.Door Lock 1
s Ext.Door Lock 1
s Int.Door Open 0
s Int.Vent Mode Mode.Out
s Int.Vent On 1
s LedLight Color Color.Red
s LedLight On 1
jal _dePressurize
s Int.Vent On 0
s Ext.Vent Mode Mode.In
s Ext.Vent PressureExternal Ext.Pressure
move rTarPressure Ext.Pressure
s Ext.Vent On 1
s LedLight Color Color.Yellow
jal _pressurize
s LedLight Color Color.Green
s Ext.Vent On 0
s Ext.Door Open 1
s Int.Door Lock 0
s Ext.Door Lock 0
pop ra
j ra

_dePressurize:
l rT Sensor Pressure
beqz rT dePressurize_end
l rT LedLight On
beqz rT dePressurize_end
j _dePressurize
dePressurize_end:
s LedLight On 1
yield
j ra

_pressurize:
l rT Sensor Pressure
bge rT rTarPressure pressurize_end
l rT LedLight On
beqz rT pressurize_end
j _pressurize
pressurize_end:
s LedLight On 1
yield
j ra

_monitorTrigger:
l rT Int.Door Setting
l rT2 Ext.Door Setting
beq rT rT2 monitorTrigger_end
l rT LedLight On
beqz rT monitorTrigger_end
yield
j _monitorTrigger
monitorTrigger_end:
yield
j ra