public void setGroupDesiredState(string groupName, bool open)
            {
                if (!_desiredStates.ContainsKey(groupName))
                {
                    return;
                }
                DoorDesiredState desired = _desiredStates[groupName];

                bool old = desired.open;

                if (old == open)
                {
                    return;
                }

                desired.open = open;
                if (open)
                {
                    (State as AutoDoorState).onOpenRequested(this);
                }
                else
                {
                    (State as AutoDoorState).onCloseRequested(this);
                }
            }
            private void updateSensors(DoorDesiredState desired)
            {
                bool old = desired.IsDesiredOpen;

                desired.removeInactiveSensors();
                if (old && !desired.IsDesiredOpen)
                {
                    (State as AutoDoorState).onCloseRequested(this);
                }
            }
            public void toggle(string groupName)
            {
                if (!_desiredStates.ContainsKey(groupName))
                {
                    return;
                }
                DoorDesiredState desired = _desiredStates[groupName];

                setGroupDesiredState(groupName, !desired.open);
            }
            public void openForSensor(IMySensorBlock sensor, string groupName)
            {
                if (!_desiredStates.ContainsKey(groupName))
                {
                    return;
                }
                DoorDesiredState desired = _desiredStates[groupName];
                bool             old     = desired.IsDesiredOpen;

                desired.openForSensors.Add(sensor);
                if (!old)
                {
                    (State as AutoDoorState).onOpenRequested(this);
                }
            }
            protected override bool updateBlocksImpl()
            {
                _hangarDoorGroups.Clear();
                Program.GridTerminalSystem.GetBlockGroups(_hangarDoorGroups, b => b.Name.Contains(BLOCK_TAG_AUTOHANGAR));

                _airVents.Clear();
                Program.GridTerminalSystem.GetBlocksOfType(_airVents, b => b.CustomName.Contains(BLOCK_TAG_AUTOHANGAR));

                _textPanels.Clear();
                Program.GridTerminalSystem.GetBlocksOfType(_textPanels, b => b.CustomName.Contains(BLOCK_TAG_AUTOHANGAR));

                foreach (DoorDesiredState desired in _desiredStates.Values)
                {
                    desired.mark = false;
                }

                foreach (IMyBlockGroup group in _hangarDoorGroups)
                {
                    DoorDesiredState desired;
                    if (_desiredStates.ContainsKey(group.Name))
                    {
                        desired = _desiredStates[group.Name];
                    }
                    else
                    {
                        desired = new DoorDesiredState();
                        _desiredStates[group.Name] = desired;
                    }
                    desired.mark = true;
                }

                _tempStrings.Clear();
                foreach (KeyValuePair <string, DoorDesiredState> desired in _desiredStates)
                {
                    if (!desired.Value.mark)
                    {
                        _tempStrings.Add(desired.Key);
                    }
                }

                foreach (string s in _tempStrings)
                {
                    _desiredStates.Remove(s);
                }

                return(true);
            }