Space Engineers

Space Engineers

1,356 valoraciones
Whip's Auto Door and Airlock Script
3
2
5
3
   
Premio
Favoritos
Favorito
Quitar
Etiquetas: other_script
Tamaño
Publicado el
Actualizado el
630.981 KB
30 MAR 2015 a las 5:34 p. m.
12 SEP 2021 a las 12:01 p. m.
50 notas sobre cambios ( ver )

Suscríbete para descargar
Whip's Auto Door and Airlock Script

En 1 colección creada por Whiplash141
Whip's Scripts
22 artículos
Descripción

  Description
"Sure, I could turn around and close the door like a civilized man.
Or I could let a robot do it for me... like a modern man.
"
    - Acarii on the virtues of automatic doors

This script will close any door once it has been fully open for over 3 seconds (10 seconds for hangar doors). The duration that a door is allowed to be open is independent of the status of any other doors. This is to say that if I open one door at a certain time then open another door a second later, each door will stay open for 3 seconds, then close. This script also supports an INFINITE amount of simple airlock systems.


  Instructions
  1. Place this script in a programmable block
  2. (Optional) Set up airlock systems
If you don't want/need the airlock functionality, only step (1) is necessary!

Auto Door Closer
The script will fetch ALL doors on the grid and automagically close any
door that has been open for a set number of seconds. Doors can also be excluded from
this feature.

Changing the Auto-Close Interval
You can change the auto close interval one of two ways:
  • Globally by changing the "auto close time" in the Custom Data of the Programmable Block
  • Per door by changing "Custom auto close time (s)" and setting "Use default auto close time" to false in the Custom Data of a Door.

Excluding Doors:
Add the tag "Excluded" anywhere in the door's name to exclude it from auto closing. Hangar doors are excluded from auto closing by default, but you can change that in the Custom Data of this programmable block.


Airlocks
This script supports the optional feature of airlock systems. Airlock systems are composed of AT LEAST one Interior Door AND one Exterior Door. The airlock status lights and sound blocks do not affect the functionality of the doors so if you don't have space for them, don't fret :)

Naming:
  • Interior doors should be named like so: "[Prefix] Airlock Interior"
  • Exterior doors should be named like so: "[Prefix] Airlock Exterior"
  • (Optional) Airlock status lights should be named like so: "[Prefix] Airlock Light"
  • (Optional) Airlock Sound Block should be named like so: "[Prefix] Airlock Sound"
  • The "[Prefix]" is the unique name that you group your airlock doors by

    Example Names:
    • "Main Airlock Interior" and "Main Airlock Exterior"
    • "[Main] Airlock Interior" and "[Main] Airlock Exterior"
    • "Potato Airlock Interior" and "Potato Airlock Exterior"
    • "1337 Airlock Interior" and "1337 Airlock Exterior"
Rules:
  • An airlock system is composed of at least one Interior Door and one Exterior Door. You can have more than one of each type of door. If you do not have one or more Interior and Exterior doors in your airlock system, that particular system will be ignored.
  • Prefixes are case insensitive and spaces are ignored
  • Doors with the same prefix are linked together in an airlock system
  • You do not need an airlock light for the doors to function properly
  • For each airlock system, if an Interior Door is opened, all Exterior Doors are locked and vice versa
  • Each airlock system operates independently of others


  Custom Data Configuration
I've rewritten this code (yet again) to support Custom Data configuration. This means that you do not need to touch any values inside of the code.

Programmable Block Config
In the Custom Data of the programmable block, you can change the global default auto close intervals as well as any and all of the name tags used by this script.
[Auto Door and Airlock - General Config] Enable automatic door closing=true Enable airlock system=true Ignore all hangar doors=true Default regular door auto close time (s)=3 Default hangar door auto close time (s)=10 Auto door exclusion name tag=Excluded Interior airlock door name tag=Airlock Interior Exterior airlock door name tag=Airlock Exterior Airlock light name tag=Airlock Light Airlock sound block name tag=Airlock Sound

Per Door Config
By popular request, if you want to set auto close intervals per door, you can do so in the Custom Data of a door.
[Auto Door and Airlock - Door Config] Use default auto close time=true ; To use a custom auto close time, set "Use default auto close time" to false Custom auto close time (s)=3

Airlock Light Config
Because hardcoding stuff is mega lame, I've also added configuration settings in the Custom Data of light blocks that are being used as airlock indicator lights.
[Auto Door and Airlock - Light Config] Turn on when airlock is open=true Airlock open - Color (R,G,B)=255, 40, 40 Airlock open - Blink interval (seconds)=0.8 Airlock open - Blink length (%)=50 Turn on when airlock is closed=true Airlock closed - Color (R,G,B)=80, 160, 255 Airlock closed - Blink interval (seconds)=0.8 Airlock closed - Blink length (%)=100


  Author's Notes
This script has been rewritten (on 2021/02/22) to support Custom Data configuration. The script is still very performance friendly, and this should make configuring stuff much cleaner since you no longer need to edit variables in the code.

This is/was my first script, I hope y'all enjoy! :)

Thanks to LordTylus for the script in his Self-Maintaining Survival Ship that I initially based the logic of the auto door closing on. It was.one of my first exposures to C# and partially responsible for piquing my interest in programming :)

If you have any questions, comments, or concerns, feel free to leave a comment.

- Whiplash141 :)

(Do not reupload without permission, not even to mod.io)
Discusiones populares Ver todo (8)
111
14 ABR a las 10:37 a. m.
FIJO: Bug Reports
Whiplash141
26
19 SEP a las 8:50 p. m.
Feature Requests
CTH2004
7
14 MAY 2021 a las 9:40 p. m.
How can I setup an Airvent to work with this?
rottielover
561 comentarios
Whiplash141  [autor] hace 2 horas 
Yep, set "Ignore all hangar doors" in the program block custom data to false
DjFrost 27 SEP a las 6:10 p. m. 
Does the auto close function work with Vanilla Hangar Doors, and if so, how do I get it to work, as I cannot figure it out lol
BCMortis 19 SEP a las 8:14 p. m. 
Can I make a small request? Either an option to (or a different script) that ONLY manages specific doors. For example, I use a lot of modded window shutters on my base, and with most auto door scripts, I end up having to manually go through and exclude dozens of shutters and interior doors I don't want the script to keep closing. Would be a lot more convenient if I could label only the doors I want the script to manage and everything else is excluded by default.
VGAstudent 18 AGO a las 11:46 a. m. 
(I could imagine a shortcut to keep the blastdoors from being affected by the close door command would be to shut the blast door blocks off, and turn them on followed with a close command to close them fast during a leak.)
VGAstudent 18 AGO a las 11:32 a. m. 
I'd love to see a Blast Door option you could trigger to close if a room became de-pressurized; Is there a run argument you can create to close blast doors when an room no longer pressurized condition is met on a vent? like "Blast Doors Close" and "Blast Doors Open"?
Gontarekt 16 AGO a las 12:33 p. m. 
Hm, I thought of that, but I prefer how this script handles it, with the changing from Blue to Blinking Red, it just looks so much cooler.
Whiplash141  [autor] 16 AGO a las 12:31 p. m. 
if you just want flashy lights when a door opens, i think the event controller might work
Gontarekt 16 AGO a las 12:25 p. m. 
Well bugger :wrongpig:
Whiplash141  [autor] 16 AGO a las 12:20 p. m. 
nope, sorry
Gontarekt 16 AGO a las 9:14 a. m. 
Frequently use this script, but is it possible to use the Airlock System Light + Sound Blocks without having it lock the doors (Blinking lights / alarm when any door of an airlock is open)? I used to use the airlock system frequently, but the locked doors do get a bit painful after a while.