Difference between revisions of "Custom Airlock IC10"
From Unofficial Stationeers Wiki
m (Use new version IC10 template for syntax highlighting.) |
m (removed unecessary <br> tags) |
||
| (One intermediate revision 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| | {{ICCode| | ||
| − | + | define Int.Pressure 100 | |
| − | + | define Ext.Pressure 0 | |
| − | define Int.Pressure 100 | + | |
| − | define Ext.Pressure 0 | + | alias Int.Door d0 |
| − | + | alias Ext.Door d1 | |
| − | alias Int.Door d0 | + | alias Int.Vent d2 |
| − | alias Ext.Door d1 | + | alias Ext.Vent d3 |
| − | alias Int.Vent d2 | + | alias Sensor d4 |
| − | alias Ext.Vent d3 | + | alias LedLight d5 |
| − | alias Sensor d4 | + | |
| − | alias LedLight d5 | + | define Color.Red 4 |
| − | + | define Color.Yellow 5 | |
| − | define Color.Red 4 | + | define Color.Green 2 |
| − | define Color.Yellow 5 | + | define Mode.Out 1 |
| − | define Color.Green 2 | + | define Mode.In 0 |
| − | define Mode.Out 1 | + | |
| − | define Mode.In 0 | + | alias rT r0 |
| − | + | alias rT2 r1 | |
| − | alias rT r0 | + | alias rTarPressure r2 |
| − | alias rT2 r1 | + | |
| − | alias rTarPressure r2 | + | Init: |
| − | + | s Int.Vent On 0 | |
| − | Init: | + | s Ext.Vent On 0 |
| − | s Int.Vent On 0 | + | s Ext.Door Mode 1 #Logic mode |
| − | s Ext.Vent On 0 | + | s Int.Door Mode 1 #Logic mode |
| − | s Ext.Door Mode 1 #Logic mode | + | s LedLight Color Color.Green |
| − | s Int.Door Mode 1 #Logic mode | + | s LedLight On 1 |
| − | s LedLight Color Color.Green | + | s Int.Door Open 0 |
| − | s LedLight On 1 | + | s Ext.Door Open 1 |
| − | s Int.Door Open 0 | + | yield |
| − | s Ext.Door Open 1 | + | |
| − | yield | + | main: |
| − | + | jal _monitorTrigger | |
| − | main: | + | jal _cycleToInt |
| − | jal _monitorTrigger | + | jal _monitorTrigger |
| − | jal _cycleToInt | + | jal _cycleToExt |
| − | jal _monitorTrigger | + | j main |
| − | jal _cycleToExt | + | |
| − | j main | + | _cycleToInt: |
| − | + | push ra | |
| − | _cycleToInt: | + | s Ext.Door Lock 1 |
| − | push ra | + | s Int.Door Lock 1 |
| − | s Ext.Door Lock 1 | + | s Ext.Door Open 0 |
| − | s Int.Door Lock 1 | + | s Ext.Vent Mode Mode.Out |
| − | s Ext.Door Open 0 | + | s Ext.Vent On 1 |
| − | s Ext.Vent Mode Mode.Out | + | s LedLight Color Color.Red |
| − | s Ext.Vent On 1 | + | s LedLight On 1 |
| − | s LedLight Color Color.Red | + | jal _dePressurize |
| − | s LedLight On 1 | + | s Ext.Vent On 0 |
| − | jal _dePressurize | + | s Int.Vent Mode Mode.In |
| − | s Ext.Vent On 0 | + | s Int.Vent PressureExternal Int.Pressure |
| − | s Int.Vent Mode Mode.In | + | move rTarPressure Int.Pressure |
| − | s Int.Vent PressureExternal Int.Pressure | + | s Int.Vent On 1 |
| − | move rTarPressure Int.Pressure | + | s LedLight Color Color.Yellow |
| − | s Int.Vent On 1 | + | jal _pressurize |
| − | s LedLight Color Color.Yellow | + | s LedLight Color Color.Green |
| − | jal _pressurize | + | s Int.Vent On 0 |
| − | s LedLight Color Color.Green | + | s Int.Door Open 1 |
| − | s Int.Vent On 0 | + | s Ext.Door Lock 0 |
| − | s Int.Door Open 1 | + | s Int.Door Lock 0 |
| − | s Ext.Door Lock 0 | + | pop ra |
| − | s Int.Door Lock 0 | + | j ra |
| − | pop ra | + | |
| − | j ra | + | _cycleToExt: |
| − | + | push ra | |
| − | _cycleToExt: | + | s Int.Door Lock 1 |
| − | push ra | + | s Ext.Door Lock 1 |
| − | s Int.Door Lock 1 | + | s Int.Door Open 0 |
| − | s Ext.Door Lock 1 | + | s Int.Vent Mode Mode.Out |
| − | s Int.Door Open 0 | + | s Int.Vent On 1 |
| − | s Int.Vent Mode Mode.Out | + | s LedLight Color Color.Red |
| − | s Int.Vent On 1 | + | s LedLight On 1 |
| − | s LedLight Color Color.Red | + | jal _dePressurize |
| − | s LedLight On 1 | + | s Int.Vent On 0 |
| − | jal _dePressurize | + | s Ext.Vent Mode Mode.In |
| − | s Int.Vent On 0 | + | s Ext.Vent PressureExternal Ext.Pressure |
| − | s Ext.Vent Mode Mode.In | + | move rTarPressure Ext.Pressure |
| − | s Ext.Vent PressureExternal Ext.Pressure | + | s Ext.Vent On 1 |
| − | move rTarPressure Ext.Pressure | + | s LedLight Color Color.Yellow |
| − | s Ext.Vent On 1 | + | jal _pressurize |
| − | s LedLight Color Color.Yellow | + | s LedLight Color Color.Green |
| − | jal _pressurize | + | s Ext.Vent On 0 |
| − | s LedLight Color Color.Green | + | s Ext.Door Open 1 |
| − | s Ext.Vent On 0 | + | s Int.Door Lock 0 |
| − | s Ext.Door Open 1 | + | s Ext.Door Lock 0 |
| − | s Int.Door Lock 0 | + | pop ra |
| − | s Ext.Door Lock 0 | + | j ra |
| − | pop ra | + | |
| − | j ra | + | _dePressurize: |
| − | + | l rT Sensor Pressure | |
| − | _dePressurize: | + | beqz rT dePressurize_end |
| − | l rT Sensor Pressure | + | l rT LedLight On |
| − | beqz rT dePressurize_end | + | beqz rT dePressurize_end |
| − | l rT LedLight On | + | j _dePressurize |
| − | beqz rT dePressurize_end | + | dePressurize_end: |
| − | j _dePressurize | + | s LedLight On 1 |
| − | dePressurize_end: | + | yield |
| − | s LedLight On 1 | + | j ra |
| − | yield | + | |
| − | j ra | + | _pressurize: |
| − | + | l rT Sensor Pressure | |
| − | _pressurize: | + | bge rT rTarPressure pressurize_end |
| − | l rT Sensor Pressure | + | l rT LedLight On |
| − | bge rT rTarPressure pressurize_end | + | beqz rT pressurize_end |
| − | l rT LedLight On | + | j _pressurize |
| − | beqz rT pressurize_end | + | pressurize_end: |
| − | j _pressurize | + | s LedLight On 1 |
| − | pressurize_end: | + | yield |
| − | s LedLight On 1 | + | j ra |
| − | yield | + | |
| − | j ra | + | _monitorTrigger: |
| − | + | l rT Int.Door Setting | |
| − | _monitorTrigger: | + | l rT2 Ext.Door Setting |
| − | l rT Int.Door Setting | + | beq rT rT2 monitorTrigger_end |
| − | l rT2 Ext.Door Setting | + | l rT LedLight On |
| − | beq rT rT2 monitorTrigger_end | + | beqz rT monitorTrigger_end |
| − | l rT LedLight On | + | yield |
| − | beqz rT monitorTrigger_end | + | j _monitorTrigger |
| − | yield | + | monitorTrigger_end: |
| − | j _monitorTrigger | + | yield |
| − | monitorTrigger_end: | + | j ra |
| − | yield | ||
| − | j ra | ||
}} | }} | ||
|} | |} | ||
Latest revision as of 03:39, 20 February 2026
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: |
|---|
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 |
