static void UseSuccessCallback(MySyncControllableEntity sync, ref UseObject_UseMsg msg, MyNetworkClient sender)
        {
            MyEntity controlledEntity;

            if (MyEntities.TryGetEntityById <MyEntity>(msg.UsedByEntityId, out controlledEntity))
            {
                var controllableEntity = controlledEntity as IMyControllableEntity;
                Debug.Assert(controllableEntity != null, "Controllable entity needs to get control from another controllable entity");

                if (controllableEntity != null)
                {
                    MyRelationsBetweenPlayerAndBlock relation = MyRelationsBetweenPlayerAndBlock.FactionShare;
                    var cubeBlock = sync.Entity as MyCubeBlock;
                    if (cubeBlock != null && controllableEntity.ControllerInfo.Controller != null)
                    {
                        relation = cubeBlock.GetUserRelationToOwner(controllableEntity.ControllerInfo.Controller.Player.Identity.IdentityId);
                    }

                    if (relation == MyRelationsBetweenPlayerAndBlock.FactionShare || relation == MyRelationsBetweenPlayerAndBlock.Owner)
                    {
                        sync.RaiseUseSuccess(msg.UseAction, controllableEntity);
                    }
                    else
                    {
                        sync.RaiseUseFailure(msg.UseAction, msg.UseResult, controllableEntity);
                    }
                }
            }
        }
        static void UseFailureCallback(MySyncControllableEntity sync, ref UseObject_UseMsg msg, MyNetworkClient sender)
        {
            MyEntity controlledEntity;
            bool     userFound = MyEntities.TryGetEntityById <MyEntity>(msg.UsedByEntityId, out controlledEntity);

            Debug.Assert(userFound);
            IMyControllableEntity controllableEntity = controlledEntity as IMyControllableEntity;

            Debug.Assert(controllableEntity != null, "Controllable entity needs to get control from another controllable entity");
            sync.RaiseUseFailure(msg.UseAction, msg.UseResult, controllableEntity);
        }
        static void UseSuccessCallback(MySyncControllableEntity sync, ref UseObject_UseMsg msg, MyNetworkClient sender)
        {
            MyEntity controlledEntity;
            if (MyEntities.TryGetEntityById<MyEntity>(msg.UsedByEntityId, out controlledEntity))
            {
                var controllableEntity = controlledEntity as IMyControllableEntity;
                Debug.Assert(controllableEntity != null, "Controllable entity needs to get control from another controllable entity");

                if (controllableEntity != null)
                {
                    MyRelationsBetweenPlayerAndBlock relation = MyRelationsBetweenPlayerAndBlock.NoOwnership;
                    var cubeBlock = sync.Entity as MyCubeBlock;
                    if (cubeBlock != null && controllableEntity.ControllerInfo.Controller != null)
                    {
                        relation = cubeBlock.GetUserRelationToOwner(controllableEntity.ControllerInfo.Controller.Player.Identity.IdentityId);
                    }

                    if (relation.IsFriendly())
                    {
                        sync.RaiseUseSuccess(msg.UseAction, controllableEntity);
                    }
                    else
                    {
                        sync.RaiseUseFailure(msg.UseAction, msg.UseResult, controllableEntity);
                    }
                }
            }
        }
 static void UseFailureCallback(MySyncControllableEntity sync, ref UseObject_UseMsg msg, MyNetworkClient sender)
 {
     MyEntity controlledEntity;
     bool userFound = MyEntities.TryGetEntityById<MyEntity>(msg.UsedByEntityId, out controlledEntity);
     Debug.Assert(userFound);
     IMyControllableEntity controllableEntity = controlledEntity as IMyControllableEntity;
     Debug.Assert(controllableEntity != null, "Controllable entity needs to get control from another controllable entity");
     sync.RaiseUseFailure(msg.UseAction, msg.UseResult, controllableEntity);
 }