Space Engineers

Space Engineers

Ship Manager
This topic has been locked
ZerothAngel  [developer] 8 Feb, 2016 @ 2:00pm
Complex Airlock Manager
(My own survival ship is a flying box, but is probably the best demo of the following.)

(Also see this awesome MS Paint image[i.imgur.com])

Configuration is all group-based and they must all have a specific name or prefix:
  • Airlock<whatever> (the <whatever> can be anything as long as it doesn't conflict with any of the group names below) - This should be a group that includes the airlock's air vent(s) and surrounding doors. Airtight hangar doors are OK. Note that doors must belong only to one "Airlock<whatever>" group.

  • AirlockDoorSpace - This should be the group of doors that are always exposed space. It can include doors from multiple "Airlock<whatever>" groups.

    Note that currently, there's no easy way to detect the presence of atmosphere on planets. You will not be able to open any doors in the AirlockDoorSpace group if you are in atmosphere. For trans-atmospheric ships, it is probably best to use simple airlocks instead.

  • AirlockDoorInner - This should be the group of doors that are (ideally) always pressurized on the other side, that is, the doors have no air vent on the "other side" and are pressurized by some other means. Like AirlockDoorSpace, it can include doors from multiple airlock groups.

    You should probably avoid using this group unless you absolutely cannot place an air vent behind the door(s). If the room happens to be depressurized, the script will happily open the airlock to vacuum thinking it is still pressurized on the other side.

  • AirlockDoor<whatever> (the <whatever> can be anything as long as it doesn't conflict with the above) - This group should include a single door (hmm, airtight hangar doors don't work with it, I guess) and all vents immediately on the "other side" of that door. The other side is relative to the "Airlock<whatever>" group that owns this door.
With all those groups defined, you can use the complex airlock manager by running the Ship Manager script with certain arguments (like from a button block):
  • inner Airlock<whatever> will always pressurize the named airlock. It will close & lock any door that has vacuum on the other side (i.e. space or another depressurized room).

  • space Airlock<whatever> will always depressurize the named airlock. It will close & lock any door that has atmosphere on the other side (i.e. any door in the AirlockDoorInner group or with an air vent that is pressurized).

  • toggle Airlock<whatever> will toggle the pressurization of the named airlock. Doors that match the new state will be unlocked while doors with the opposite state will be locked.

  • open AirlockDoor<whatever> will match the owning airlock's pressurization with that outside of AirlockDoor<whatever>'s air vent.
So with all that, the rules are simple: if the airlock's pressurization matches that outside a particular door, that door is unlocked. Otherwise it is locked. This allows for some really neat setups like having an airlock lead to a hangar which leads to space and for example, if you pressurize everything, you can then freely walk between hangar, airlock, and the rest of the ship because the doors will be unlocked.

Troubleshooting

Like I mentioned, there are currently no failsafes. There are two ways the airlock script can fail:
  1. The airlock fails to depressurize because your oxygen tanks are full. First, look into the Oxygen Manager, which is also part of this script. Alternatively, hook up the airlock's vent into an independent oxygen tank, one not connected to any oxygen generators/farms.

    But to actually solve this problem, you could try opening and closing the inner door multiple times (let it open and close fully). As far as I know, doors still destroy a "block" of oxygen when they close. Of course, this assumes all your oxygen generators/farms are currently disabled... again, see the Oxygen Manager.

  2. The airlock fails to pressurize due to lack of oxygen (usually due to damage or something). There's no general fix for this other than manually depressurizing vents on the "other side."
Last edited by ZerothAngel; 16 Oct, 2016 @ 5:08pm