Airlock LCD Panel Indicator 0/5 (2)

posted in: Scripts | 2

This script can be used to display a “no entry” sign (or whatever texture you want) on an LCD panel when an airlock is depressurized.

To set up, have an Air Vent and LCD Panel(s). If your Air Vent is named “Air Vent 1”, name the LCD Panel(s): “Air Vent 1 Panel”. You can have multiple panels for a single vent, just name them all the same (in our example, “Air Vent 1 Panel”).

For each panel, go into the settings for the panel and add the texture you want to show when depressurized by selecting the texture under “Loaded textures” and clicking the “Add to selection” button.

Once that is done, paste the script below into a programmable block and set a timer to run the programmable block however frequently you want.

When the air vent is depressurized, the panel(s) will show the selected texture, when it is pressurized, it will show the public text (or black screen if there is no public text).


void Main() {

    List<IMyTerminalBlock> vents = new List<IMyTerminalBlock>();

    // Load "vents" list with of Air Vents
    GridTerminalSystem.GetBlocksOfType<IMyAirVent>(vents);

    for (int i = 0; i < vents.Count; i++)
    {
        IMyAirVent vent = vents[i] as IMyAirVent;
        List<IMyTerminalBlock> panels = new List<IMyTerminalBlock>();
        GridTerminalSystem.SearchBlocksOfName(vent.CustomName + " Panel", panels);
        Boolean pressurized = vent.DetailedInfo.Contains("Room pressure: 100.00%");
        for (int j = 0; j < panels.Count; j++)
        {
            if (panels[j] is IMyTextPanel) {
                var p = (IMyTextPanel)panels[j];
                if (pressurized) {
                    p.ShowPublicTextOnScreen();
                } else {
                    p.ShowTextureOnScreen();
                }
            }
        }
    }
}

Please rate this post

2 Responses

  1. Master_crab90

    Is there a way to have it cycle through 2 textures??

Leave a Reply