public void Init(MyCubeBlock myBlock, ConveyorLinePosition a, ConveyorLinePosition b, MyObjectBuilder_ConveyorLine.LineType type, MyObjectBuilder_ConveyorLine.LineConductivity conductivity = MyObjectBuilder_ConveyorLine.LineConductivity.FULL) { CubeBlock = myBlock; ConnectingPosition1 = a; ConnectingPosition2 = b; // Neighbour grid position of one of the connecting positions is inside this block var linePosition = (myBlock as IMyConveyorSegmentBlock).ConveyorSegment.ConnectingPosition1.NeighbourGridPosition; ConveyorLine = myBlock.CubeGrid.GridSystems.ConveyorSystem.GetDeserializingLine(linePosition); if (ConveyorLine == null) { ConveyorLine = new MyConveyorLine(); if (IsCorner) ConveyorLine.Init(a, b, myBlock.CubeGrid, type, conductivity, CalculateCornerPosition()); else ConveyorLine.Init(a, b, myBlock.CubeGrid, type, conductivity, (Vector3I?)null); } else { Debug.Assert(ConveyorLine.Type == type, "Conveyor line type mismatch on segment deserialization"); } myBlock.SlimBlock.ComponentStack.IsFunctionalChanged += CubeBlock_IsFunctionalChanged; }
public bool CanConnectTo(ConveyorLinePosition connectingPosition, MyObjectBuilder_ConveyorLine.LineType type) { if (type == ConveyorLine.Type && (connectingPosition.Equals(ConnectingPosition1.GetConnectingPosition()) || connectingPosition.Equals(ConnectingPosition2.GetConnectingPosition())) ) return true; return false; }
public ConveyorLine( CubeGridEntity parent, MyObjectBuilder_ConveyorLine definition ) : base( definition ) { }