Пример #1
0
 public static void Attach(IMyPistonBase block)
 {
     if (!block.IsAttached)
     {
         IMyPistonTop top = FindTop(block);
         if (top != null)
         {
             block.Attach(top, true);
         }
         else
         {
             block.Attach();
         }
         MyAPIGateway.Utilities.InvokeOnGameThread(() => FinalizeAttach(block));
     }
 }
Пример #2
0
        private static void OnSmallTopCreated(IMyPistonBase block, List <IMyCubeGrid> temp)
        {
            IMyCubeGrid topGrid = temp.FirstOrDefault();

            if (topGrid == null)
            {
                return;
            }

            IMyPistonTop top = topGrid.GetCubeBlock(Vector3I.Zero)?.FatBlock as IMyPistonTop;

            if (top == null)
            {
                MyAPIGateway.Entities.MarkForClose(topGrid);
            }
            else
            {
                block.Attach(top, true);
                MyAPIGateway.Utilities.InvokeOnGameThread(() => FinalizeAttach(block));
            }
        }