Space Engineers

Space Engineers

Not enough ratings
Automatic Doors and Airlocks
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
18.656 KB
30 Sep, 2018 @ 1:48am
17 Aug, 2019 @ 9:17am
5 Change Notes ( view )

Subscribe to download
Automatic Doors and Airlocks

Description
This script makes doors close automatically.

Features:
- Sets all doors in a given list to close automatically with a given delay
- Sets all doors in the grid to close automatically with a given delay, except the ones who's names begin with one or more given patterns
- Creates airlock systems of two doors each, so that one door closes automatically when the other is open
- Creates airlock systems of three or more doors to limit loss of oxygen or to create puzzles
- Create auto-sealing airlocks (one door powered down and closed while the other is open, opening or closing)
- Sets airlock systems to close automatically with a given delay
- The delay is configurable

Instructions and examples can be found at the top of the script's body.

SPECIAL THANKS to Stelio Kimbos for the auto-sealing airlock feature
SPECIAL THANKS to Silverdog for the group exclusion feature
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!!