Beispiel #1
0
 public static bool isFunctional(IMyTerminalBlock block)
 {
     if (block is IMyMechanicalConnectionBlock)
     {
         IMyAttachableTopBlock top = (block as IMyMechanicalConnectionBlock).Top;
         if (top == null || !top.IsFunctional)
         {
             return(false);
         }
     }
     return(block.IsFunctional);
 }
 public void Attach()
 {
     if (PendingAttachment && !IsAttached)
     {
         var attachment = MockPendingAttachment as MockMotorRotor;
         if (attachment != null)
         {
             Top                   = attachment;
             attachment.Base       = this;
             MockPendingAttachment = null;
         }
         else
         {
             throw new NotSupportedException("Cannot attach Rotors which are not Mocks");
         }
     }
 }
        protected static List <IMyCubeGrid> getChildGridsOf(IMyCubeGrid grid)
        {
            List <IMyCubeGrid>  ret = new List <IMyCubeGrid>();
            List <IMySlimBlock> li  = new List <IMySlimBlock>();

            grid.GetBlocks(li);
            foreach (IMySlimBlock b in li)
            {
                IMyCubeBlock bk = b.FatBlock;
                if (bk is IMyMechanicalConnectionBlock)
                {
                    //MyAPIGateway.Utilities.ShowNotification("Found a connection "+bk.DefinitionDisplayNameText);
                    IMyAttachableTopBlock con = (bk as IMyMechanicalConnectionBlock).Top;
                    if (con != null && con.CubeGrid != null && con.CubeGrid != grid && !ret.Contains(con.CubeGrid))
                    {
                        //MyAPIGateway.Utilities.ShowNotification("Found grid ID "+con.CubeGrid.EntityId+" as a child of "+grid.EntityId);
                        ret.Add(con.CubeGrid);
                    }
                }
            }
            return(ret);
        }
 public void Detach()
 {
     MockPendingAttachment = Top;
     Top = null;
 }
Beispiel #5
0
 /// <summary>
 ///     Initializes a new instance of <see cref="PlaceSmartHingeData" /> work data.
 /// </summary>
 /// <param name="head"></param>
 public PlaceSmartHingeData(IMyAttachableTopBlock head)
 {
     Head = head;
 }
Beispiel #6
0
 /// <summary>
 ///     Initializes a new instance of <see cref="PlacePadData" /> work data.
 /// </summary>
 /// <param name="head"></param>
 public PlacePadData(IMyAttachableTopBlock head)
 {
     Head   = head;
     Result = DataResult.Running;
 }