Space Engineers

Space Engineers

Airlock Master Computer v1.72 - with air seal/depressurize waiting!
110 Comments
maverick Dec 8, 2019 @ 8:16pm 
needs to be updated
Adi May 6, 2017 @ 2:09pm 
An OnOff toggle for the doors would be godly to lock the doors after the script opened/closed the doors. That way people won't be able to accidentally open the doors manually.

I've tried to change the script to do this, but I don't really know how to add a delay and because of that sometimes the doors won't turn on fast enough and the script can't close them.
Chip Patton Dec 21, 2016 @ 1:55pm 
Digi, can you add a simple OnOff_On and OnOff_Off to the door properties during the main loop. I had this working in your script before I wiped my server and didn't save it :P

Basically I had simply made a new function to turn doors on and off after waiting 10 ticks.

If you try doing it before and after Open_On or Open_Off, it bugs out the airlocks, the doors will still be in their last state but the control panel will have them registered as opposite of what you see... It's a mess :P Its just a lot easier to place a pause in there before doing it.

Should be pretty simple to do, if you need any help or code sniplets, let me know, though I'm more than sure you're capable.
A__Gun Aug 25, 2016 @ 3:03am 
I changed line 279 to 'if(!seal || oxygen < 1)' , instead of just 'if(!seal)' and that seems to have made it wait for airlock re-pressurization before opening the inner door. I did also have to move the declaration of the oxygen variable for this to work.

Been a long time since i've coded and first time looking at it within SE, so please take this with a pinch of salt.
buder28 Feb 7, 2016 @ 12:36am 
now i know a sugestion having a wait time for each airlock set because hangar is way slower to close/open than sliding door
Twitch.tv/Jafu29 Feb 2, 2016 @ 4:32am 
y i think it works just try it... i dont have any issues
buder28 Feb 1, 2016 @ 11:18pm 
is it working with hangar door?
Twitch.tv/Jafu29 Dec 17, 2015 @ 1:55pm 
Is it possible to make a delay inside the Script to delay the detection of the activation of the trigger block?
werdna23 Nov 14, 2015 @ 5:04pm 
keeps saying failed to find inside doors
werdna23 Nov 14, 2015 @ 5:03pm 
i keep coming up with a failed execution for the doors everything is named correctly i even tried it in creative mode and doesnt work
Digi  [author] Oct 10, 2015 @ 7:24am 
Game has issues with oxygen right now, look in the bug reports on the forum :P
MikhaVT Oct 9, 2015 @ 2:37pm 
hey i'm having trouble getting my airlocks to depressurize, i have an airvent in the airlock and it doesnt seem to try to depressurize the airlock
Tech_BuRn Aug 16, 2015 @ 4:45pm 
That was the exact scenario I was trying to explain Kairos a couple comments down. The problem has to do with space engineers oxygen code. It has been broken since it was introduced.
N-Trippy Aug 16, 2015 @ 11:40am 
Hey Digi. I noticed that the script doesn't wait for the inside door to be closed before depressurizing. Could you add a place for users to set a delay before depressurizing occurs? Additionally, the system doesn't wait for 100% pressurization before opening inside doors, causing a draft. I don't know C# so I couldn't tell where (if anywhere) this is set.
Digi  [author] Aug 15, 2015 @ 1:04pm 
If multiple blocks have the same name, all of them will be used, applies for all blocks usable by the script.
N-Trippy Aug 15, 2015 @ 12:58pm 
Hey I'm sure someone asked this before but it would be insane to scroll through every comment, but how do I use multiple doors on one end. To give some context, one of my airlocks is my hangar and uses five Airtight Hangar Doors. Any chance you can update the description with this info?
vorticone Aug 5, 2015 @ 2:00pm 
Wonderful script, does almost exactly what I was aiming for with my airlocks. Just one small question: do you think it would be possible to have the doors in a disabled block state so the engineer is forced to use the button panels?
Tech_BuRn Jul 29, 2015 @ 5:42pm 
It only happens when the vent is triggered to depressurize as the door is closing, if there is a 3 second delay which I tested manually, room A doesn't have all the oxygen magically disappear. Could you add a delay or at least try it out? I realize its a space engineers bug and not your script at all. Making the vent and doors not trigger simultaneously will fix this :D
Digi  [author] Jul 29, 2015 @ 12:43pm 
Problem seems to be (from what I've just tested) that you lose oxygen just by opening and closing doors that are in between pressurized rooms, I'm not sure a delay will help at all xD
Tech_BuRn Jul 29, 2015 @ 12:48am 
My apologies if this has been covered already. When leaving a room to head into space (room A) to go into room B which is the airlock chamber. Room A will lose all oxygen while room B is depressurizing to get ready to go to space.

The exact time the oxygen loss occurs is when the button is pressed to cycle. The door closes as the vent is set to depressurize. If you wait a few seconds after the inner door closes and then you let the vent go to depressurize mode, the oxygen in room A will stay. I'm assuming this is an old oxygen glitch in the game.

My question is, can you, or is there a way I could insert some kind of delay, so that the inner door closes, waits for 3 seconds or more, and then the depressurization occurs. When trying to do the opposite from space, the delay is not necessary. So far only trying to leave an oxygenated environment to head to space, this loss occurs.
Morphik Jul 16, 2015 @ 11:53pm 
Thanks Digi, I had to fix mine too. Ship felt baron with few scripts working. They really should have notified us in the changelog of a major change to how the api handles block groups.
Digi  [author] Jul 16, 2015 @ 4:36pm 
Fixed to work with the recent game update.
Chip Patton Jul 16, 2015 @ 1:18pm 
Hiya Digi... The update seems to have broken everyone's scripts :( Any chance you can have a look?
Capybellie Apr 27, 2015 @ 2:30am 
Well, that is exactly the problem.
The LCD Script lists all blocks with the same name.
What I am asking is if it would be possible to have a setting to "comment out" part of the block name. e.g. Airlock 1 Outside -Door- so your script would work even though blocks end up with different names. If that is way too complicated, it's fine. Your script is great in any case ;)
Digi  [author] Apr 26, 2015 @ 5:56pm 
@Hiramas
I don't understand what you're asking, special word that ignores what exacly ? My script doesn't list blocks on LCDs so I'm not sure how that will even help.
It sounds like an issue with your LCD block list script, that one needs to only read one block and not all of them with the same name.
Capybellie Apr 26, 2015 @ 1:46pm 
Greetings, great script. I even use it without any reason to, because my Base has a lot of bare rock and probably will never be fully pressurized. But the Immersion with your script is just awesome.
Now, one small question: Would it be possible to set the Airlock ID in a way that there is a special word that is just ignored by the script?
The reason is, I use LCD Displays to monitor the status of my Hangars. When I use this script with Hangar doors I end up with a HUGE list of blocks on the Status Screens, though I just need to see one. Maybe the script could read an alias Airlock ID or just ignore a certain word, so I could set up one of the doors for my monitoring without affecting the scripts work?
Digi  [author] Apr 19, 2015 @ 5:23pm 
Well that's why it's configurable :P
Mohs Apr 19, 2015 @ 1:35pm 
In v1.71 the default settings for airvents is wrong. It must be set to:
ventDepressurize[0] = true; // Closing inside door
ventDepressurize[1] = false; // Closing outside door
ventDepressurize[2] = false; // Opening inside door
ventDepressurize[3] = true; // Opening outside door
Otherwise it will pressurize any room outside, if that is pressurizable. If that is not the case you can probably ignore this.
Morphik Apr 19, 2015 @ 10:20am 
NICE! :D I was developing my own airlock script, but now that you added these features I don't have too. :P

I am glad you are awesome and implemented some of my idea's :D
Digi  [author] Apr 19, 2015 @ 8:44am 
Alright, v1.71 is out, added the pressurization waiting by checking for seal (not waiting for the room to fill up).

I also changed the default ventDepressurize setting for going inside from depressurize to pressurize because it relies on that variable to tell what you want the airlock to wait for, seal or depressurization.

Let me know if you find any loopholes that need some failsafes :P

@Morphik
I also tested it on your published workshop world, it now works nicely with the hangar doors :P
Morphik Apr 18, 2015 @ 2:55pm 
You could just use IsPressurized() to see if the room is sealed to open the inner doors, just in case someone doesn't have any oxygen to put into the airlock, so it doesn't lock them out.
Morphik Apr 18, 2015 @ 2:52pm 
Oh okay sorry for the confusion, I was sitting on the other side of the doors watching the LCD screen readouts. The problem I was encountering then was the small doors opening and exhausting all the oxygen before the hangar doors could close like you said.
Digi  [author] Apr 18, 2015 @ 2:42pm 
@Morphik
I'm not sure what you're testing but when I press the button to close the small doors it does wait to depressurize and then opens the hangar doors.

You can see this effect in larger scale by making a larger airlock room that depressurizes more slowly, you'll see that the script does not open the doors until it's depressurized.

But there is another problem there, when you close the hangar doors... the script needs to wait for the room to start pressurizing before opening the inner doors, which is something I need to add xD
Morphik Apr 18, 2015 @ 2:07pm 
Sorry if I am being a pain in your tush Digi, I made a world to test your program in. I am not sure if it's set up right but the script doesn't seem to wait for the room to depressurize to open the outer doors.

This is my world with the Airtight Hangar Doors, not working with your script.
http://steamcommunity.com/sharedfiles/filedetails/?id=427837262
Digi  [author] Apr 18, 2015 @ 10:38am 
Well, I've updated the script with depressurization waiting which is enabled by default.

Airlocks without air vents will work as before (or if you disable the feature).

I also added a failsafe in case oxygen levels don't drop for 2 seconds.

And I've updated the screen text to include oxygen level if applicable.
Morphik Apr 18, 2015 @ 9:31am 
Well I was thinking this would allow people to use the airtight hangar doors and regular in different airlocks without having to set all the outside airlocks to long delays. Just a thought.
Digi  [author] Apr 18, 2015 @ 9:13am 
@Morphik
Well an immediate problem with that is when you don't have any space in your oxygen tanks to store the air from the room, that would cause the airlock to never open =) Not sure how to handle that scenario.
Morphik Apr 18, 2015 @ 7:41am 
I do have a question for you Digi, any way you can use the vents GetOxygenLevel() in your script to prevent the outside doors from opening until the airlock is completly empty? instead of having to rely on the openOutsideDelay float?
Morphik Apr 18, 2015 @ 7:27am 
That's my best guess, it could have just been a fluke.
Morphik Apr 18, 2015 @ 7:26am 
It's working now, sorry for the false alarm. I lost ownership of the doors, thats why it wasn't working.
Digi  [author] Apr 18, 2015 @ 5:43am 
@Morphik
Hmm, any errors in the PB?
And can you tell me what type of blocks do you have on the airlock and how many airlocks ?
Morphik Apr 18, 2015 @ 2:49am 
Digi, I can't seem to get it to work anymore. I know I have it set up right because it was still set up from your previous version but now all it does when I toggle the trigger light is cycle the depressurize and reset, no doors open or anything.
oseriduun Apr 17, 2015 @ 2:38pm 
i am aware of the timer variables, which was a great idea, and would have been necessary for our map, as we're using a huge list of mods. (S Airlock doors).

i've got the variables set to 5 seconds, but i think it would be better to use the timer to tell the script how long before activating vent, then checking the room pressure each script run until it reaches desired levels, then open the next door. (just a thought)..

I will update my script today and let you know if its still happening. if it is, i can grant you access to our steam group and get a first hand look.
Digi  [author] Apr 17, 2015 @ 9:14am 
A small update, the vents are now forced to the depressurize status directly without reading the value first, this avoids the language dependancy on the vent status.


@oseriduun
The script already has 2 variables to control the duration of each way, going in or going out, did you see those ?

And due to the recent update, please re-test that depressurize status if it still seems wrong and if it does can you share your world or a blueprint or something so I can replicate it ? :}
oseriduun Apr 14, 2015 @ 1:10pm 
just wanted to say that i love this script, but i would like to know if its possible for you to add an optional timer to the decompression process so that i dont have doors opening/closing before the proper state is achieved to reduce oxygen waste. or at the least have the script check to make sure the room pressure is null before opening outer door. I'm asking this because i have an issue similar to leewells described on apr 7th where the vent depressurizes, then before the outer door opens, repressurizes.

also worth noting is that the script says 'depressurizing' when your actually pressurizing the room (closing outer, fill air, open inner)
Chip Patton Apr 8, 2015 @ 3:03am 
NVM Digi answered VV
Chip Patton Apr 8, 2015 @ 3:02am 
@rottielover simply set the share on the doors to no one but yourself. Everyone will be forced to use the button that is set for the trigger.
Digi  [author] Apr 8, 2015 @ 2:01am 
@rottielover
I wanted to do that long before but it doesn't work, it needs a delay between powering on a block and triggering the open/close action which would make it highly complicated considering it can work with variable triggering options and such :P

A simple solution is to not share the door blocks, that way only you can directly use them.


@patrick2160
Read the code and the comments at the top, there are 2 variables to set delays between closing and opening doors.
Railgunner2160 Apr 7, 2015 @ 7:48pm 
What would I need to edit If I wanted to add in more delay between theclosing of one door and the opening of the other?? I'm using Sektan's Airlock Doors but they're a tad slow, take a bit for them to close/open, so one door is still closing when the other opens, It's not too much of a gap but I'm worried about wasting O2....
rottielover Apr 7, 2015 @ 4:23pm 
Question: Is it possible to add an optional "lockout" funtion to the script? I would like to do something like this: If I set a variable at the top of your script (on or off, or 1 or 2 whatever) then based on that: Mode 1 Normal no change to the function of your script. Mode 2 - "saftey lockout" - The doors would be powered OFF when not called by the script so that a player cannot accidently hit "T" on them and open them. The script would need to power cycle the door when cycleing the open and closing. Does that make sense?