示例#1
0
        public void GetCoveyorInventoryOwners()
        {
            m_inventoryOwners.Clear();
            List <IMyConveyorEndpoint> reachableVertices = new List <IMyConveyorEndpoint>();

            MyGridConveyorSystem.FindReachable(this.ConveyorEndpoint, reachableVertices, (vertex) => vertex.CubeBlock != null && FriendlyWithBlock(vertex.CubeBlock) && vertex.CubeBlock.HasInventory);

            foreach (var vertex in reachableVertices)
            {
                m_inventoryOwners.Add(vertex.CubeBlock);
            }
            m_inventoryOwnersDirty = false;
        }
示例#2
0
        private bool IsConnected(MyInventory dstInventory)
        {
            var srcConveyor = (this.Owner as IMyConveyorEndpointBlock);

            if (srcConveyor != null)
            {
                reachableVertices.Clear();
                MyGridConveyorSystem.FindReachable(srcConveyor.ConveyorEndpoint, reachableVertices, (vertex) => vertex.CubeBlock != null);
                foreach (var vertex in reachableVertices)
                {
                    if (dstInventory.Owner == vertex.CubeBlock)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#3
0
        private MyAssembler GetMasterAssembler()
        {
            m_conveyorEndpoints.Clear();

            m_assemblerForPathfinding = this;

            MyGridConveyorSystem.FindReachable(this.ConveyorEndpoint, m_conveyorEndpoints, m_vertexPredicate, m_edgePredicate);

            MyUtils.ShuffleList <IMyConveyorEndpoint>(m_conveyorEndpoints);

            foreach (var ep in m_conveyorEndpoints)
            {
                var ass = ep.CubeBlock as MyAssembler;
                if (ass != null && !ass.DisassembleEnabled && !ass.IsSlave && ass.m_queue.Count > 0)
                {
                    return(ass);
                }
            }
            return(null);
        }