private static void OnAttach(MySyncPistonBase sync, ref AttachMsg msg, MyNetworkClient sender)
        {
            MyPistonBase pistonBase  = (MyPistonBase)sync.Entity;
            MyEntity     rotorEntity = null;

            if (!MyEntities.TryGetEntityById(msg.TopEntityId, out rotorEntity))
            {
                pistonBase.RetryAttach(msg.TopEntityId);
                Debug.Assert(false, "Could not find top entity to attach to base");
                return;
            }
            MyPistonTop top = (MyPistonTop)rotorEntity;

            Debug.Assert(pistonBase.CubeGrid != top.CubeGrid, "Trying to attach top to base on the same grid");

            if (top.CubeGrid.InScene == false)
            {
                pistonBase.RetryAttach(msg.TopEntityId);
            }
            else
            {
                pistonBase.Attach(top, false);
            }

            if (Sync.IsServer)
            {
                Sync.Layer.SendMessageToAllButOne(ref msg, sender.SteamUserId);
            }
        }
        private static void OnAttach(MySyncPistonBase sync, ref AttachMsg msg, MyNetworkClient sender)
        {
            MyPistonBase pistonBase  = (MyPistonBase)sync.Entity;
            MyEntity     rotorEntity = null;

            if (!MyEntities.TryGetEntityById(msg.TopEntityId, out rotorEntity))
            {
                Debug.Assert(false, "Could not find top entity to attach to base");
                return;
            }
            MyPistonTop top = (MyPistonTop)rotorEntity;

            Debug.Assert(pistonBase.CubeGrid != top.CubeGrid, "Trying to attach top to base on the same grid");

            pistonBase.Attach(top);
        }
        // ReSharper disable once InconsistentNaming
        private static void InitPatch(MyPistonBase __instance)
        {
            var blockDefinition = __instance.BlockDefinition;

            __instance.Velocity.ValueChangedInRange(-blockDefinition.MaxVelocity, blockDefinition.MaxVelocity);

            var minimum = blockDefinition.Minimum;
            var maximum = blockDefinition.Maximum;

            __instance.MaxLimit.ValueChangedInRange(minimum, maximum);
            __instance.MinLimit.ValueChangedInRange(minimum, maximum);

            var maxImpulseAxis = MySandboxGame.Config.ExperimentalMode
                ? float.MaxValue
                : blockDefinition.UnsafeImpulseThreshold;

            __instance.MaxImpulseAxis.ValueChangedInRange(100, maxImpulseAxis);
            __instance.MaxImpulseNonAxis.ValueChangedInRange(100, maxImpulseAxis);
        }
 public MySyncPistonBase(MyPistonBase block)
     : base(block)
 {
 }