public override bool Detach(bool updateGroup = true)
        {
            if (m_topBlock != null && updateGroup)
            {
                MyPistonTop pistonTop = m_topBlock as MyPistonTop;
                if (pistonTop != null)
                {
                    m_conveyorEndpoint.Detach(pistonTop.ConveyorEndpoint as MyAttachableConveyorEndpoint);
                }
            }
            var ret = base.Detach(updateGroup);

            return(ret);
        }
Example #2
0
        internal void Detach()
        {
            if (m_constraint == null)
            {
                return;
            }

            Debug.Assert(m_constraint != null);
            Debug.Assert(m_topGrid != null);
            Debug.Assert(m_topBlock != null);

            var tmpTopGrid = m_topGrid;

            m_fixedData.Dispose();
            m_fixedData = null;
            CubeGrid.Physics.RemoveConstraint(m_constraint);
            m_constraint.Dispose();
            m_constraint = null;
            m_topGrid    = null;
            if (m_topBlock != null)
            {
                m_topBlock.Detach();
            }
            tmpTopGrid.OnPhysicsChanged -= CubeGrid_OnPhysicsChanged;
            m_conveyorEndpoint.Detach(m_topBlock.ConveyorEndpoint as MyAttachableConveyorEndpoint);

            m_topBlock = null;

            OnConstraintRemoved(GridLinkTypeEnum.Physical, tmpTopGrid);
            OnConstraintRemoved(GridLinkTypeEnum.Logical, tmpTopGrid);
            UpdateText();
        }
 protected override void Detach(bool updateGroup = true)
 {
     if (TopBlock != null && updateGroup)
     {
         MyPistonTop pistonTop = TopBlock as MyPistonTop;
         if (pistonTop != null)
         {
             m_conveyorEndpoint.Detach(pistonTop.ConveyorEndpoint as MyAttachableConveyorEndpoint);
         }
     }
     base.Detach(updateGroup);
 }