Space Engineers

Space Engineers

Automatic Doors and Airlocks
14 Comments
catalinioan.georgescu  [author] 17 Aug, 2019 @ 9:30am 
Now there is. Thanks for the idea, btw. I modified the doorToBeExcludedFromAutoclosing() method in AutoClosingDoorsManager - changed Equals() to StartsWith(). The config section at the top of the script remains the same, except now when you write autoClosingDoorsManager.excludeDoor("EXCL"); in InitAutoClosingDoors(), it will exclude all doors having names beginning with "EXCL". Of course, you can change "EXCL" with "HANGAR" ir anything you like.
Silverdog 17 Aug, 2019 @ 7:22am 
Is there a way to exclude a group of doors (In most cases hangar doors) from autoclosing without typing in every single one? Maybe someting like a part of the name (so you can still name each door)?
Punkachuros 7 Jul, 2019 @ 4:28am 
Since i'm French i have a hard time figuring out what to do, even when i call them "TEST EXCLUDED DOOR" and recompile it doesn't say anything in the bottom right ^^'
I'm new to script, but i don't understand why you tell me to do won't work
catalinioan.georgescu  [author] 7 Jul, 2019 @ 2:53am 
Go to the programmable block where you put the script and press the "Recompile" button. After that, you should see a message in the script output, at the bottom right of the window, confirming that the door has been excluded from the auto-closing doors list. The indexing of objects only happens when the script initializes. This behavior is necessary to avoid CPU-expensive API calls at runtime.
Punkachuros 6 Jul, 2019 @ 5:39am 
It's a really nice Script, i love for the main door of my ship, but i got a problem with my hanger door, even with "TEST EXCLUDED DOOR" it won't open, it close itselft back up :steamsad:
Stelio Kimbos 4 Jun, 2019 @ 3:47am 
Nice job!! and thanks
catalinioan.georgescu  [author] 16 May, 2019 @ 12:51pm 
If it's any help, I added the feature you wanted. Thanks for the idea :) I tried to do the "until DOOR A not closed" part when I wrote the script last year, but wasn't able to using the TerminalPropertyExtensions. Now I see IMyDoor has a Status property which has the needed info.

Some times it's easier to start fresh rather than to add to existing code. The idea is pretty simple. Program() is called only when the script initializes, so you should get the references to the doors in there. to avoid unnecessary CPU usage. You can reuse findBlockOfTypeWithName. Main() runs periodically, so that's where you need to check the door status. You can use IMyDoor.Status and do something similar to my DoorEventWatcher.tick() to detect a status change.

Best of luck!
Stelio Kimbos 14 May, 2019 @ 11:53am 
Thank you very much, I thought u have a method written, that ex: If (DOOR A is open) then DOOR B PWR_STATE_OFF until DOOR A not closed. I was trying do that in your script, but not work how i want XD. im really noob scripting. Thanks for your work.
catalinioan.georgescu  [author] 12 May, 2019 @ 11:05am 
Your english is fine :) I get what you're saying and you're right. If at least one of the doors is not completely closed, the ship will lose air.

This is a simple script. It doesn't handle vents for depressurization. There's a way you can minimize the loss of oxygen. You should stick the two doors together and set the airlock to automatically close. You can also set the AUTO_CLOSE_INTERVAL_CYCLES variables lower to decrease the wait time till the door closes. Then, all you have to do is wait for the door to close before opening the other one. The wait time is not as high as with air vents.

One other thing that was quick and easy to do: I updated the script to make it possible to chain up 3 or more doors in one airlock system. With 3 doors, there's no need for automatic close delays. Example::
airlockManager.createAirlock("AIRLOCK03 DOOR A", "AIRLOCK03 DOOR B", "AIRLOCK03 DOOR C");

I hope this helps to some extent.
Stelio Kimbos 10 May, 2019 @ 7:18am 
i was watchng the code, and i don't understand why with an airlock system, when i opened a door i open the next and i got out all my oxigen. The new open door close the other door, but it's enought time to lose your oxygen. i saw the method seal, but i think doen't work.

Sorry my english, i hope someone understand my problem, maybe im doing something worng.

And thanks for your work!!
Demize74 2 Feb, 2019 @ 8:13am 
Thank you for the reply, my issue was that my airtight hanger doors would barely open then close, ended up having to set up a timer block to switch the programable block on/off.. but I will try your updated version. again, thank you very much for the reply.
catalinioan.georgescu  [author] 2 Feb, 2019 @ 12:05am 
You can't figure out how to turn off the auto-close because the option doesn't exist :) Once a door has been set up to auto-close, it will keep closing until you delete the programmable block.

I made a small update to the script. Now you have the option to specify the names of the doors that you don't want to set up as auto-closing. You can do that by writing
autoClosingDoorsManager.excludeDoor("door name");
just above the call to addAllDoorsNotPartOfAirlocks() in the config method InitAutoClosingDoors().

The script is already set up to ignore any door named "TEST EXCLUDED DOOR".

Have fun!
Demize74 29 Jan, 2019 @ 6:06pm 
Love this script, but how the hell do I turn off the autoclose for hanger doors? Can't figure it out...
CT_Marauder 12 Oct, 2018 @ 9:54pm 
nice idea thumbs up