public void Add(IMyOxygenBlock block)
            {
                var consumer = block as IMyOxygenConsumer;

                if (consumer != null && consumer.ConsumptionNeed(MyEngineConstants.UPDATE_STEP_SIZE_IN_SECONDS) > 0f)
                {
                    List<IMyOxygenConsumer> oxygenConsumerList;
                    int consumerPriority = consumer.GetPriority();
                    if (Consumers.TryGetValue(consumerPriority, out oxygenConsumerList))
                    {
                        oxygenConsumerList.Add(consumer);
                    }
                    else
                    {
                        var newConsumerList = new List<IMyOxygenConsumer>();
                        newConsumerList.Add(consumer);
                        Consumers.Add(consumer.GetPriority(), newConsumerList);
                    }
                }
                else
                {
                    var producer = block as IMyOxygenProducer;
                    if (producer != null && producer.ProductionCapacity(MyEngineConstants.UPDATE_STEP_SIZE_IN_SECONDS) > 0f)
                    {
                        List<IMyOxygenProducer> oxygenProducerList;
                        int producerPriority = producer.GetPriority();
                        if (Producers.TryGetValue(producerPriority, out oxygenProducerList))
                        {
                            oxygenProducerList.Add(producer);
                        }
                        else
                        {
                            var newProducerList = new List<IMyOxygenProducer>();
                            newProducerList.Add(producer);
                            Producers.Add(producer.GetPriority(), newProducerList);
                        }
                    }
                    else
                    {
                        var tank = block as MyOxygenTank;
                        if (tank != null)
                        {
                            Tanks.Add(tank);
                            if (!tank.IsStockpiling)
                            {
                                NonStockpilingTanks.Add(tank);
                            }
                        }
                    }
                }
            }
 public void UnregisterOxygenBlock(IMyOxygenBlock block)
 {
     Debug.Assert(m_oxygenBlocks.Contains(block));
     m_oxygenBlocks.Remove(block);
 }
            public OxygenProductionGroup(IMyOxygenBlock block)
            {
                var consumer = block as IMyOxygenConsumer;
                var producer = block as IMyOxygenProducer;
                var tank = block as MyOxygenTank;

                Producers = null;
                Consumers = null;
                FirstEndpoint = null;

                Consumers = new SortedDictionary<int, List<IMyOxygenConsumer>>();
                if (consumer != null)
                {
                    var newConsumerList = new List<IMyOxygenConsumer>();
                    newConsumerList.Add(consumer);
                    Consumers.Add(consumer.GetPriority(), newConsumerList);
                    FirstEndpoint = consumer.ConveyorEndpoint;
                }

                Producers = new SortedDictionary<int, List<IMyOxygenProducer>>();
                if (producer != null)
                {
                    var newProducerList = new List<IMyOxygenProducer>();
                    newProducerList.Add(producer);
                    Producers.Add(producer.GetPriority(), newProducerList);
                    FirstEndpoint = producer.ConveyorEndpoint;
                }

                Tanks = new List<MyOxygenTank>();
                NonStockpilingTanks = new List<MyOxygenTank>();
                if (tank != null)
                {
                    Tanks.Add(tank);
                    if (!tank.IsStockpiling)
                    {
                        NonStockpilingTanks.Add(tank);
                    }
                    FirstEndpoint = tank.ConveyorEndpoint;
                }
            }
 public void RegisterOxygenBlock(IMyOxygenBlock block)
 {
     Debug.Assert(!m_oxygenBlocks.Contains(block));
     m_oxygenBlocks.Add(block);
 }