Exemple #1
0
        /// <remarks>
        /// Different from the others because share mode matters.
        /// </remarks>
        public static bool canControlBlock(this long ownerId, VRage.Game.ModAPI.Ingame.IMyCubeBlock target)
        {
            switch (target.GetUserRelationToOwner(ownerId))
            {
            case MyRelationsBetweenPlayerAndBlock.Enemies:
            case MyRelationsBetweenPlayerAndBlock.Neutral:
                return(false);

            case MyRelationsBetweenPlayerAndBlock.FactionShare:
            case MyRelationsBetweenPlayerAndBlock.Owner:
                return(true);

            case MyRelationsBetweenPlayerAndBlock.NoOwnership:
            default:
                return(target.OwnerId == 0);
            }
        }