Esempio n. 1
0
 public void InitializeConveyorSegment()
 {
     MyConveyorLine.BlockLinePositionInformation[] blockLinePositions = MyConveyorLine.GetBlockLinePositions(this);
     if (blockLinePositions.Length != 0)
     {
         ConveyorLinePosition connectingPosition = this.PositionToGridCoords(blockLinePositions[0].Position).GetConnectingPosition();
         this.m_segment.Init(this, connectingPosition, this.PositionToGridCoords(blockLinePositions[1].Position).GetConnectingPosition(), blockLinePositions[0].LineType, MyObjectBuilder_ConveyorLine.LineConductivity.FULL);
     }
 }
        public void InitializeConveyorSegment()
        {
            MyConveyorLine.BlockLinePositionInformation[] positionInfo = MyConveyorLine.GetBlockLinePositions(this);

            Debug.Assert(positionInfo.Length == 2, "Dummies not correctly defined for conveyor frame");

            if (positionInfo.Length > 0)
            {
                ConveyorLinePosition position1 = PositionToGridCoords(positionInfo[0].Position).GetConnectingPosition();
                ConveyorLinePosition position2 = PositionToGridCoords(positionInfo[1].Position).GetConnectingPosition();
                Debug.Assert(positionInfo[0].LineType == positionInfo[1].LineType, "Inconsistent conveyor line type in conveyor segment block model");

                m_segment.Init(this, position1, position2, positionInfo[0].LineType);
            }
        }
Esempio n. 3
0
        public MyMultilineConveyorEndpoint(MyCubeBlock myBlock)
        {
            ProfilerShort.Begin("MyMultilineConveyorEndpoint(...)");
            m_block = myBlock;

            MyConveyorLine.BlockLinePositionInformation[] positionInfo = MyConveyorLine.GetBlockLinePositions(myBlock);
            m_conveyorLines = new MyConveyorLine[positionInfo.Length];

            MyGridConveyorSystem conveyorSystem = myBlock.CubeGrid.GridSystems.ConveyorSystem;

            int i = 0;

            foreach (var position in positionInfo)
            {
                var gridPosition = PositionToGridCoords(position.Position);

                MyConveyorLine line = conveyorSystem.GetDeserializingLine(gridPosition);
                if (line == null)
                {
                    line = new MyConveyorLine();
                    line.Init(gridPosition, gridPosition.GetConnectingPosition(), myBlock.CubeGrid, position.LineType, position.LineConductivity);
                    line.InitEndpoints(this, null);
                }
                else
                {
                    if (line.GetEndpointPosition(0).Equals(gridPosition))
                    {
                        line.SetEndpoint(0, this);
                    }
                    else if (line.GetEndpointPosition(1).Equals(gridPosition))
                    {
                        line.SetEndpoint(1, this);
                    }
                }
                m_conveyorLines[i] = line;
                i++;
            }

            myBlock.SlimBlock.ComponentStack.IsFunctionalChanged += UpdateLineFunctionality;
            myBlock.CubeGrid.GridSystems.ConveyorSystem.ResourceSink.IsPoweredChanged += UpdateLineFunctionality;

            m_pathfindingData = new MyPathfindingData(this);
            ProfilerShort.End();
        }