Exemple #1
0
        void RepairDamaged(IMyCubeBlock block, IMyTerminalBlock nearestWelder)
        {
            if (activeRepairs.FirstOrDefault(x => x.Welder == nearestWelder && x.DamagedBlock == block) == null)             //&& DistanceSquared(nearestWelder, block)<maximumWelderDamagedDistance
            {
                this.Echo(string.Format($"Welder: {nearestWelder.DisplayNameText}, {nearestWelder.EntityId}"));

                if (DistanceSquared(nearestWelder.GetPosition(), block.GetPosition()) < maximumWelderDamagedDistance)
                {
                    try
                    {
                        nearestWelder.ApplyAction("OnOff_On");
                    }
                    catch (Exception ex)
                    {
                        Echo(ex.Message);
                    }

                    activeRepairs.Add(new MyRepairInfo(nearestWelder, block, DistanceSquared(nearestWelder, block)));
                }
                else
                {
                    Echo("Distance to big " + nearestWelder.DisplayNameText + ":" + DistanceSquared(nearestWelder, block).ToString());
                }
            }
        }
Exemple #2
0
        void Main()
        {
            // initialize
            VRage.MyFixedPoint totalVolume    = 0;
            VRage.MyFixedPoint totalMaxVolume = 0;

            var blocks = new List <IMyTerminalBlock>();

            GridTerminalSystem.GetBlocksOfType <IMyInventoryOwner>(blocks, FilterInventoryOwner);

            if (blocks.Count == 0)
            {
                throw new Exception("Did not find any cargo container.");
            }

            for (int i = 0; i < blocks.Count; ++i)
            {
                var invOwner = blocks[i] as IMyInventoryOwner;
                for (int j = 0; j < invOwner.InventoryCount; ++j)
                {
                    var inv = invOwner.GetInventory(j);
                    totalVolume    += inv.CurrentVolume;
                    totalMaxVolume += inv.MaxVolume;
                }
            }

            blocks = new List <IMyTerminalBlock>();
            GridTerminalSystem.GetBlocksOfType <IMyBeacon>(blocks, FilterAntenna);
            GridTerminalSystem.GetBlocksOfType <IMyRadioAntenna>(blocks, FilterAntenna);
            if (blocks.Count == 0)
            {
                throw new Exception("Did not find the specified antenna");
            }

            var           antenna = blocks[0];
            StringBuilder sb      = new StringBuilder();

            sb.Append(antennaName).Append(" - ");
            sb.Append((long)(totalVolume * K)).Append(" / ").Append((long)(totalMaxVolume * K));
            sb.Append(" (").Append(VRageMath.MathHelper.RoundOn2(100 * (float)(totalVolume * K) / (float)(totalMaxVolume * K))).Append("%)");
            //antenna.SetCustomName(sb.ToString());

            if (totalVolume == totalMaxVolume)
            {
                IMyTerminalBlock block = GridTerminalSystem.GetBlockWithName(stop);
                if (block == null)
                {
                    throw new Exception("Could not find block with name: '" + stop + "'");
                }

                block.SetCustomName(block.CustomName + "full,");
                block.ApplyAction("Run");
            }


            Echo(sb.ToString());
            debug.Clear();
        }
Exemple #3
0
 void On()
 {
     workFlag = true;
     foreach (IMyTerminalBlock drill in drillsList)
     {
         drill.ApplyAction("OnOff_On");
     }
     gyro.ApplyAction("OnOff_On");
     rotor.ApplyAction("OnOff_On");
 }
Exemple #4
0
    public void Main(string args)
    {
        Turret.ApplyAction("ShootOnce");

        LCD = GridTerminalSystem.GetBlockWithName("LCD") as IMyTextPanel;
        if (LCD != null)
        {
            i++;
            Echo(i.ToString());
        }
    }
Exemple #5
0
 public bool startNextTick()
 {
     if (timer == null)
     {
         _findTimer();
         return(false);
     }
     else
     {
         timer.ApplyAction("TriggerNow");
         return(true);
     }
 }
Exemple #6
0
 public void setEnabled(bool enable)
 {
     if (block is IMyReactor)
     {
         (block as IMyReactor).Enabled = enable;
     }
     else if (block is IMySolarPanel)
     {
         block.ApplyAction(enable ? "OnOff_On" : "OnOff_Off");
     }
     else if (block is IMyBatteryBlock)
     {
         (block as IMyBatteryBlock).Enabled = enable;
     }
 }
Exemple #7
0
 private void ShowOnHud(IMyTerminalBlock block, bool show)
 {
     if (showDamagedOnHud && !(block is IMyRadioAntenna))
     {
         if (show)
         {
             try
             {
                 if (block != null)
                 {
                     block.ApplyAction("ShowOnHUD_On");
                 }
             }
             catch (Exception ex)
             {
                 //Some exceptions are caused by grids connected via connector
                 Echo(ex.Message + block.DisplayNameText);
             }
         }
         else
         {
             try
             {
                 if (block != null)
                 {
                     block.ApplyAction("ShowOnHUD_Off");
                 }
             }
             catch (Exception ex)
             {
                 //Some exceptions are caused by grids connected via connector
                 Echo(ex.Message + block.DisplayNameText);
             }
         }
     }
 }
Exemple #8
0
        protected void executeBlock(IMyTerminalBlock block)
        {
            this.myProgram.Echo(this.blockName + " " + this.action + " " + this.value);
            if (block == null)
            {
                this.haltError = true;
                return;
            }

            switch (this.action)
            {
            case "Apply":
                if (this.value == "On")
                {
                    this.value = "OnOff_On";
                }
                if (this.value == "Off")
                {
                    this.value = "OnOff_Off";
                }
                block.ApplyAction(this.value);
                return;

            case "Check":
                if (this.value == "On" || this.value == "Off")
                {
                    bool onoff = block.GetValueBool("OnOff");
                    if (this.value == "On" && !onoff)
                    {
                        this.haltError = true;
                        return;
                    }
                    if (this.value == "Off" && onoff)
                    {
                        this.haltError = true;
                        return;
                    }
                }
                if (this.value == "Attach" || this.value == "Detach")
                {
                    bool rotorAttached = ((IMyMotorStator)block).IsAttached;
                    if (this.value == "Attach" && !rotorAttached)
                    {
                        this.haltError = true;
                        return;
                    }
                    if (this.value == "Detach" && rotorAttached)
                    {
                        this.haltError = true;
                        return;
                    }
                }
                if (this.value == "Extend" || this.value == "Retract")
                {
                    PistonStatus pistonExtended = ((IMyPistonBase)block).Status;
                    if (pistonExtended == PistonStatus.Stopped)
                    {
                        this.haltError = true;
                        return;
                    }

                    if (this.value == "Extend" && pistonExtended == PistonStatus.Retracted)
                    {
                        this.haltError = true;
                        return;
                    }
                    if (this.value == "Retract" && pistonExtended == PistonStatus.Extended)
                    {
                        this.haltError = true;
                        return;
                    }
                }
                return;

            case "Velocity":
                block.SetValue <Single>("Velocity", Single.Parse(this.value));
                return;

            case "MaxLimit":
                block.SetValue <Single>("UpperLimit", Single.Parse(this.value));
                return;

            case "MinLimit":
                block.SetValue <Single>("LowerLimit", Single.Parse(this.value));
                return;
            }
        }
        /*==#=====#====#=====#=====#=====#=====#=====#====#=====#=====#=====#=====#=====#====#===================*/
        //dont edit unless you know what you are doing !//
        /*==#=====#====#=====#=====#=====#=====#=====#====#=====#=====#=====#=====#=====#====#===================*/

        void Main(string argument)
        {
            //IMyTextPanel infotxt = GridTerminalSystem.GetBlockWithName(INFO_NAME) as IMyTextPanel;

            //string[] info = GetRef(infotxt, SEP);

            IMyTextPanel DemandTxt = GridTerminalSystem.GetBlockWithName(DEMAND_NAME) as IMyTextPanel;

            LcdClear();

            if (argument == " ")
            {
                List <IMyTerminalBlock> output = MultiBlockGet(OUTPUT_NAME);

                List <IMyTerminalBlock> TempCargo = MultiBlockGet(INTERMEDIATE_NAME);

                string NewDemand = "";

                List <string> demands = GetData(DemandTxt, DEMAND_TYPE);

                string[] DemandDetail;

                foreach (string demand in demands)
                {
                    DemandDetail = demand.Split(SEP1);

                    IMyTerminalBlock Assembler = GridTerminalSystem.GetBlockWithName(DemandDetail[1]);

                    IMyTerminalBlock[] AssemblerArray = new IMyTerminalBlock[] { Assembler as IMyTerminalBlock };

                    double offer = CheckInventoryForType <IMyTerminalBlock>(TempCargo.ToArray(), DemandDetail[1]) / (1000000);

                    LcdPrintln(offer.ToString() + ":" + DemandDetail[2]);
                    LcdPrintln(demand);

                    if (offer >= Convert.ToDouble(DemandDetail[2]))
                    {
                        LcdPrintln("if");

                        Assembler.ApplyAction("OnOff_Off");

                        TransferInventoryType <IMyTerminalBlock, IMyTerminalBlock>(TempCargo.ToArray(), output.ToArray(), DemandDetail[1] + " " + "Component");
                    }
                    else
                    {
                        LcdPrintln("else");

                        NewDemand = NewDemand + "\n" + demand;

                        //ITerminalAction TurnOn = Assembler.GetActionWithName("OnOff_On");

                        Assembler.ApplyAction("OnOff_On");
                    }

                    TransferInventoryType <IMyTerminalBlock, IMyTerminalBlock>(AssemblerArray, TempCargo.ToArray(), DemandDetail[1] + " " + "Component", 1);
                }

                DemandTxt.WritePublicText(NewDemand);
            }
            else
            {
                string demand = GetRaw(DemandTxt);

                demand = demand + "\n" + argument;

                LcdClear(DEMAND_NAME);

                LcdPrint(demand, DEMAND_NAME);
            }
        }
Exemple #10
0
        public void Main(string arg)
        {
            if ((DateTime.Now - last_greetings) < greetings_interval)
            {
                debug_panel.WriteText($"Last greetings: {DateTime.Now - last_greetings} {((DateTime.Now - last_greetings) < greetings_interval)}");
                return;
            }
            else
            {
                can_greet = true;
            }

            if (can_greet)
            {
                if (!player_is_inside)
                {
                    detected_entities.Clear();
                    sensor.DetectedEntities(detected_entities);
                    foreach (MyDetectedEntityInfo entity in detected_entities)
                    {
                        if (entity.Type == player_type)
                        {
                            player_entity    = entity;
                            player_is_inside = true;
                            sensor.Enabled   = false;
                            ticks_passed     = 0;
                            break;
                        }
                    }
                }
                else
                {
                    if (ticks_passed < 100)
                    {
                        greet_panel.WriteText($"{central_n}{authorization_spaces}\\    Authorization    \\");
                    }
                    else if (ticks_passed < 200)
                    {
                        greet_panel.WriteText($"{central_n}{authorization_spaces}|    Authorization.   |");
                    }
                    else if (ticks_passed < 300)
                    {
                        greet_panel.WriteText($"{central_n}{authorization_spaces}/   Authorization..  /");
                    }
                    else if (ticks_passed < 400)
                    {
                        greet_panel.WriteText($"{central_n}{authorization_spaces}\\   Authorization... \\");
                    }
                    else if (ticks_passed < 500)
                    {
                        greet_panel.WriteText($"{central_n}{authorization_spaces}|   Authorization... |");
                    }
                    else if (ticks_passed < 600)
                    {
                        greet_panel.WriteText($"{central_n}{authorization_spaces}/   Authorization... /");
                    }
                    else if (ticks_passed < 1200)
                    {
                        if (player_entity.Name == greeted_player_name)
                        {
                            if (!greeting_started)
                            {
                                greet_panel.WriteText($"{central_n}            Welcome back, commander");
                                jukebox.ApplyAction("OnOff_On");
                                greeting_started = true;
                            }
                        }
                    }
                    else
                    {
                        jukebox.ApplyAction("OnOff_Off");
                        sensor.Enabled   = true;
                        player_is_inside = false;
                        can_greet        = false;
                        greeting_started = false;
                        last_greetings   = DateTime.Now;
                        return;
                    }
                    ticks_passed = ticks_passed + 100;
                }
            }
        }
Exemple #11
0
            public void ExecuteInstruction()
            {
                if (Instructions.Count <= 0 || Instructions.Count < Line)
                {
                    return;
                }
                Instruction instruction = Instructions[Line];
                string      name, mode, action, search, property, source;
                float       value1  = 0f;
                float       value2  = 0f;
                float       epsilon = 0.1f;
                bool        bool1   = false;
                bool        bool2   = false;
                Object      var;

                switch (instruction.Command)
                {
                case Command.Comment:
                    Line++;
                    break;

                case Command.Var:
                    // var <var name> <float value>
                    name = instruction.Fields[0];
                    ParseFieldFloat(instruction.Fields[1], out value1);
                    Vars.Add(name, value1);
                    Line++;
                    break;

                case Command.Add:
                case Command.Sub:
                case Command.Mul:
                case Command.Div:
                    // <operator> <var name> <var name|float value> <float value>
                    name = instruction.Fields[0];
                    ParseFieldFloat(instruction.Fields[1], out value1);
                    ParseFieldFloat(instruction.Fields[2], out value2);
                    float result = 0f;
                    switch (instruction.Command)
                    {
                    case Command.Add:
                        result = value1 + value2;
                        break;

                    case Command.Sub:
                        result = value1 - value2;
                        break;

                    case Command.Mul:
                        result = value1 * value2;
                        break;

                    case Command.Div:
                        result = value1 / value2;
                        break;
                    }
                    Vars[name] = result;
                    Line++;
                    break;

                case Command.Print:
                    bool   append  = true;
                    string message = ParseFieldString(instruction.Fields[0]);
                    message = "\n" + message;
                    if (instruction.Fields.Count > 1)
                    {
                        List <string> args = new List <string>();
                        for (int i = 1; i < instruction.Fields.Count; i++)
                        {
                            float value;
                            ParseFieldFloat(instruction.Fields[1], out value);
                            args.Add(value.ToString());
                        }
                        myProgram.drawingSurface.WriteText(string.Format(message, args.ToArray()), append);
                    }
                    else
                    {
                        myProgram.drawingSurface.WriteText(message, append);
                    }
                    Line++;
                    break;

                case Command.Select:
                    // select <var name> <mode> <string value>
                    //myProgram.drawingSurface.WriteText($"\nSelect fields={instruction.Fields.Count}", true);
                    name   = instruction.Fields[0];
                    mode   = instruction.Fields[1];
                    search = instruction.Fields[2];
                    List <IMyTerminalBlock> blocks = new List <IMyTerminalBlock>();
                    switch (mode)
                    {
                    case "tag":
                        myProgram.GridTerminalSystem.GetBlocksOfType <IMyTerminalBlock>(blocks, myBlock => myBlock.CustomName.Contains(search));
                        if (blocks.Count > 0)
                        {
                            Vars.Add(name, blocks);
                        }
                        break;

                    case "group":
                        IMyBlockGroup group = myProgram.GridTerminalSystem.GetBlockGroupWithName(search);
                        group.GetBlocks(blocks);
                        if (blocks.Count > 0)
                        {
                            Vars.Add(name, blocks);
                        }
                        break;

                    default:
                        IMyTerminalBlock block = myProgram.GridTerminalSystem.GetBlockWithName(search);
                        if (block != null)
                        {
                            blocks.Add(block);
                            Vars.Add(name, blocks);
                        }
                        break;
                    }
                    Line++;
                    break;

                case Command.Action:
                    // action <var name> <action>
                    name   = instruction.Fields[0];
                    action = instruction.Fields[1];
                    Vars.TryGetValue(name, out var);
                    if (instruction.Fields.Count == 3)
                    {
                        ParseFieldFloat(instruction.Fields[2], out value1);
                    }
                    if (var != null)
                    {
                        blocks = (List <IMyTerminalBlock>)var;
                        blocks.ForEach(delegate(IMyTerminalBlock block) {
                            block.ApplyAction(action);
                        });
                    }
                    Line++;
                    break;

                case Command.Set:
                    // set <var name> <property> <value>
                    name     = instruction.Fields[0];
                    property = instruction.Fields[1];
                    Vars.TryGetValue(name, out var);
                    if (var != null)
                    {
                        if (var is List <IMyTerminalBlock> )
                        {
                            blocks = (List <IMyTerminalBlock>)var;
                            if (blocks.Count > 0)
                            {
                                IMyTerminalBlock  firstBlock = blocks[0];
                                ITerminalProperty prop       = firstBlock.GetProperty(property);
                                //myProgram.drawingSurface.WriteText($"\nProperty={prop.TypeName}", true);
                                switch (prop.TypeName)
                                {
                                case "Single":
                                    ParseFieldFloat(instruction.Fields[2], out value1);
                                    break;

                                case "Boolean":
                                    ParseFieldBool(instruction.Fields[2], out bool1);
                                    break;
                                }
                                blocks.ForEach(delegate(IMyTerminalBlock block)
                                {
                                    switch (prop.TypeName)
                                    {
                                    case "Single":
                                        block.SetValueFloat(property, value1);
                                        break;

                                    case "Boolean":
                                        block.SetValueBool(property, bool1);
                                        break;
                                    }
                                });
                            }
                        }
                    }
                    Line++;
                    break;

                case Command.Get:
                    // get <var name> <property> <var name>
                    name     = instruction.Fields[0];
                    property = instruction.Fields[1];
                    source   = instruction.Fields[2];
                    Vars.TryGetValue(source, out var);
                    if (var != null)
                    {
                        if (var is List <IMyTerminalBlock> )
                        {
                            blocks = (List <IMyTerminalBlock>)var;
                            if (blocks.Count > 0)
                            {
                                IMyTerminalBlock  firstBlock = blocks[0];
                                ITerminalProperty prop       = firstBlock.GetProperty(property);
                                switch (prop.TypeName)
                                {
                                case "Single":
                                    Vars.Add(name, firstBlock.GetValueFloat(property));
                                    break;

                                case "Boolean":
                                    Vars.Add(name, firstBlock.GetValueBool(property));
                                    break;
                                }
                            }
                        }
                    }
                    Line++;
                    break;

                case Command.Wait:
                    // wait <var name> <property> <value> <epsilon>
                    name     = instruction.Fields[0];
                    property = instruction.Fields[1];
                    if (instruction.Fields.Count > 3)
                    {
                        ParseFieldFloat(instruction.Fields[3], out epsilon);
                    }
                    Vars.TryGetValue(name, out var);
                    bool isState = true;
                    if (var != null)
                    {
                        if (var is List <IMyTerminalBlock> )
                        {
                            blocks = (List <IMyTerminalBlock>)var;
                            if (blocks.Count > 0)
                            {
                                ITerminalProperty prop       = null;
                                IMyTerminalBlock  firstBlock = blocks[0];
                                prop = firstBlock.GetProperty(property);
                                if (prop == null)
                                {
                                    switch (GetAttibutType(property))
                                    {
                                    case "Single":
                                        ParseFieldFloat(instruction.Fields[2], out value1);
                                        break;

                                    case "Boolean":
                                        ParseFieldBool(instruction.Fields[2], out bool1);
                                        break;
                                    }
                                }
                                else
                                {
                                    switch (prop.TypeName)
                                    {
                                    case "Single":
                                        ParseFieldFloat(instruction.Fields[2], out value1);
                                        break;

                                    case "Boolean":
                                        ParseFieldBool(instruction.Fields[2], out bool1);
                                        break;
                                    }
                                    break;
                                }

                                blocks.ForEach(delegate(IMyTerminalBlock block)
                                {
                                    if (prop == null)
                                    {
                                        switch (GetAttibutType(property))
                                        {
                                        case "Single":
                                            value2 = GetAttibutFloat(block, property);
                                            if (Math.Abs(value2 - value1) > epsilon)
                                            {
                                                isState = false;
                                            }
                                            break;

                                        case "Boolean":
                                            bool2 = GetAttibutBool(block, property);
                                            if (bool2 != bool1)
                                            {
                                                isState = false;
                                            }
                                            break;
                                        }
                                    }
                                    else
                                    {
                                        switch (prop.TypeName)
                                        {
                                        case "Single":
                                            value2 = block.GetValueFloat(property);
                                            if (Math.Abs(value2 - value1) > epsilon)
                                            {
                                                isState = false;
                                            }
                                            break;

                                        case "Boolean":
                                            bool2 = block.GetValueBool(property);
                                            if (bool2 != bool1)
                                            {
                                                isState = false;
                                            }
                                            break;
                                        }
                                    }
                                });
                            }
                        }
                    }
                    if (isState)
                    {
                        Line++;
                    }
                    break;
                }
            }
 private void EnableBlock(IMyTerminalBlock block, bool enable)
 {
     block.ApplyAction(enable ? "OnOff_On" : "OnOff_Off");
     // block.Enabled = enable;
 }
Exemple #13
0
 /// <summary>
 /// Akce
 /// </summary>
 /// <param name="block">Blok</param>
 /// <param name="action">Akce</param>
 public static void Action(IMyTerminalBlock block, string action)
 {
     // block.GetActionWithName(action).Apply(block);
     block.ApplyAction(action);
 }
Exemple #14
0
        public HangarController(IMyGridTerminalSystem grid, IMyProgrammableBlock me, Action <string> echo, TimeSpan elapsedTime)
        {
            GridTerminalSystem = grid;
            Echo        = echo;
            ElapsedTime = elapsedTime;
            Me          = me;

            hangarDoors   = new List <IMyDoor> [groups.Count];
            interiorDoors = new List <IMyDoor> [groups.Count];
            exteriorDoors = new List <IMyDoor> [groups.Count];
            soundBlocks   = new List <IMySoundBlock> [groups.Count];
            warningLights = new List <IMyInteriorLight> [groups.Count];
            airVents      = new List <IMyAirVent> [groups.Count];

            hangarOpen = new Boolean[groups.Count];

            // Get list of groups on this station/ship
            List <IMyBlockGroup> BlockGroups = new List <IMyBlockGroup>();

            GridTerminalSystem.GetBlockGroups(BlockGroups);

            // Search all groups that exist for the groups with name as specified in groups list
            for (int i = 0; i < BlockGroups.Count; i++)
            {
                int pos = groups.IndexOf(BlockGroups[i].Name);
                // If name is one of our candidates...
                if (pos != -1)
                {
                    List <IMyTerminalBlock> blocks = BlockGroups[i].Blocks;

                    // Define list of blocks for each group
                    List <IMyDoor>          hangarDoorList   = new List <IMyDoor>();
                    List <IMyDoor>          interiorDoorList = new List <IMyDoor>();
                    List <IMyDoor>          exteriorDoorList = new List <IMyDoor>();
                    List <IMySoundBlock>    soundBlockList   = new List <IMySoundBlock>();
                    List <IMyInteriorLight> warningLightList = new List <IMyInteriorLight>();
                    List <IMyAirVent>       airVentList      = new List <IMyAirVent>();

                    // Go through all blocks and add to appropriate list
                    // Also initialize to a sane known state e.g. closed, on...
                    for (int j = 0; j < blocks.Count; j++)
                    {
                        IMyTerminalBlock block     = blocks[j];
                        String           blockType = block.DefinitionDisplayNameText;
                        String           blockName = block.CustomName;
                        block.ApplyAction("OnOff_On");

                        if (blockType.Equals("Airtight Hangar Door"))
                        {
                            IMyDoor item = block as IMyDoor;
                            item.ApplyAction("Open_Off");
                            hangarDoorList.Add(item);
                        }
                        else if ((blockType.Equals("Sliding Door") || blockType.Equals("Door")) && blockName.Contains("Interior"))
                        {
                            IMyDoor item = block as IMyDoor;
                            item.ApplyAction("Open_Off");
                            interiorDoorList.Add(item);
                        }
                        else if ((blockType.Equals("Sliding Door") || blockType.Equals("Door")) && blockName.Contains("Exterior"))
                        {
                            IMyDoor item = block as IMyDoor;
                            item.ApplyAction("Open_Off");
                            exteriorDoorList.Add(item);
                        }
                        else if (blockType.Equals("Sound Block"))
                        {
                            IMySoundBlock item = block as IMySoundBlock;
                            item.ApplyAction("StopSound");
                            item.SetValueFloat("LoopableSlider", 10);
                            soundBlockList.Add(item);
                        }
                        else if (blockType.Equals("Interior Light"))
                        {
                            IMyInteriorLight item = block as IMyInteriorLight;
                            item.ApplyAction("OnOff_Off");
                            item.SetValueFloat("Blink Interval", 1);
                            item.SetValueFloat("Blink Lenght", 50);
                            item.SetValueFloat("Blink Offset", 0);
                            item.SetValue <Color>("Color", Color.Red);
                            warningLightList.Add(item);
                        }
                        else if (blockType.Contains("Air Vent"))
                        {
                            IMyAirVent item = block as IMyAirVent;
                            item.ApplyAction("Depressurize_Off");
                            airVentList.Add(item);
                        }
                    }

                    // Some cleanup
                    hangarDoorList.TrimExcess();
                    interiorDoorList.TrimExcess();
                    exteriorDoorList.TrimExcess();
                    soundBlockList.TrimExcess();
                    warningLightList.TrimExcess();
                    airVentList.TrimExcess();

                    if (hangarDoorList.Count == 0)
                    {
                        Echo("Warning: no hangar doors detected for " + BlockGroups[i].Name);
                    }
                    else if (interiorDoorList.Count == 0)
                    {
                        Echo("Warning: no interior doors detected for " + BlockGroups[i].Name);
                    }
                    else if (soundBlockList.Count == 0)
                    {
                        Echo("Warning: no sound blocks detected for " + BlockGroups[i].Name);
                    }
                    else if (warningLightList.Count == 0)
                    {
                        Echo("Warning: no warning lights detected for " + BlockGroups[i].Name);
                    }
                    else if (airVentList.Count == 0)
                    {
                        Echo("Warning: no air vents detected for " + BlockGroups[i].Name);
                    }

                    // Now that we have populated lists add them to the correct position in the group list

                    hangarDoors[pos]   = hangarDoorList;
                    interiorDoors[pos] = interiorDoorList;
                    exteriorDoors[pos] = exteriorDoorList;
                    soundBlocks[pos]   = soundBlockList;
                    warningLights[pos] = warningLightList;
                    airVents[pos]      = airVentList;
                    hangarOpen[pos]    = false;

                    // Exterior doors have been requested to close so we set a check to lock them when they are in fact closed
                    requests.Add(new requestTicket(pos, "lockExteriorDoors"));
                }
            }
        }