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)); } }
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)); } }