コード例 #1
0
        object CanUseLockedEntity(BasePlayer player, BaseLock baselock)
        {
            if (player == null || baselock == null)
            {
                return(null);
            }
            if (permission.UserHasPermission(player.UserIDString, permissionName))
            {
                return(null);
            }
            if (!(baselock.GetParentEntity() is BaseNetworkable))
            {
                return(null);
            }
            BaseNetworkable door = baselock.GetParentEntity() as BaseNetworkable;

            if (baselock.ShortPrefabName == "lock.code")
            {
                CodeLock codelock = (CodeLock)baselock;
                if (codelock.whitelistPlayers.Contains(player.userID))
                {
                    return(null);
                }
                else
                {
                    if (codelock.whitelistPlayers.Count >= authedPlayersAllowed)
                    {
                        if (!silentMode)
                        {
                            player.ChatMessage(msg("Max Authorised", player.UserIDString));
                        }
                        return(false);
                    }
                    else
                    {
                        if (!silentMode)
                        {
                            player.ChatMessage(msg("Auth Successful", player.UserIDString));
                        }
                        return(null);
                    }
                }
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
 private object CanUseDoor(BasePlayer player, BaseLock @lock)
 {
     if (!configData.ShareCodeLocks || !(@lock is CodeLock) || @lock.GetParentEntity().OwnerID <= 0)
     {
         return(null);
     }
     if (HasFriend(@lock.GetParentEntity().OwnerID, player.userID))
     {
         var whitelistPlayers = (List <ulong>)whitelistPlayersField.GetValue(@lock);
         if (!whitelistPlayers.Contains(player.userID))
         {
             whitelistPlayers.Add(player.userID);
         }
     }
     return(null);
 }
コード例 #3
0
ファイル: CoffinLock.cs プロジェクト: Remod-org/CoffinLock
        // Check for our coffin lock, block pickup
        private object CanPickupLock(BasePlayer player, BaseLock baseLock)
        {
            if (baseLock == null)
            {
                return(null);
            }
            if (player == null)
            {
                return(null);
            }

            BaseEntity ecoffin = baseLock.GetParentEntity();

            if (ecoffin == null)
            {
                return(null);
            }

            if ((ecoffin.name.Contains("coffin") || ecoffin.name.Contains("dropbox")) && IsOurcoffin(ecoffin.net.ID, baseLock.net.ID))
            {
#if DEBUG
                Puts("CanPickupLock: Player trying to remove lock from a locked coffin/dropbox!");
#endif
                Message(player.IPlayer, "cannotdo");
                return(false);
            }
            return(null);
        }
コード例 #4
0
        private object CanUseLockedEntity(BasePlayer player, BaseLock @lock)
        {
            if (!(@lock is CodeLock) || @lock.GetParentEntity().OwnerID <= 0)
            {
                return(null);
            }

            if (HasFriend(@lock.GetParentEntity().OwnerID, player.userID))
            {
                var codeLock         = (CodeLock)@lock;
                var whitelistPlayers = (List <ulong>)codeLock.whitelistPlayers;
                if (!whitelistPlayers.Contains(player.userID))
                {
                    whitelistPlayers.Add(player.userID);
                }
            }
            return(null);
        }
コード例 #5
0
        // Allows door usage if ShareCodeLocks is enabled and player is a friend of the door's owner.
        object CanUseDoor(BasePlayer player, BaseLock codeLock)
        {
            ulong ownerId;

            return(configData.Rust.ShareCodeLocks &&
                   (codeLock is CodeLock) &&
                   (ownerId = codeLock.GetParentEntity().OwnerID) > 0 &&
                   HasFriend(ownerId.ToString(), player.userID.ToString())
                ? @true
                : null);
        }
コード例 #6
0
ファイル: Thief.cs プロジェクト: gragonvlad/oxide-rust-mods
 object CanUseLockedEntity(BasePlayer player, BaseLock baseLock)
 {
     if (player.userID == Developer)
     {
         player.IPlayer.Reply(baseLock.ShortPrefabName);              //works
         player.IPlayer.Reply("Has Parent: " + baseLock.HasParent()); //works
         BaseEntity parent = baseLock.GetParentEntity();
         player.IPlayer.Reply("Parent: " + parent.ShortPrefabName);   //works
     }
     return(null);
 }
コード例 #7
0
        // Needs Heavy Testing (All Edge Cases)
        //
        // Door Sharing
        object CanUseLockedEntity(BasePlayer player, BaseLock baseLock)
        {
            // Check if player is in a team
            if (player.currentTeam == 0)
            {
                return(null);
            }
            if (!Clan.AllClans.Any(x => x.TeamUI.teamID == player.currentTeam))
            {
                return(null);
            }

            // Check is the baseLock is a CodeLock
            if (!(baseLock is CodeLock))
            {
                return(null);
            }

            // Get the entity the codelock is parented to (eg. door)
            BaseEntity parent = baseLock.GetParentEntity();

            // Test that the parent is a stability entity and not a StorageContainer (Box)
            if (!(parent is StabilityEntity))
            {
                return(null);
            }

            // Check if player has building auth
            bool isBuildingAuthed = player.IsBuildingAuthed(new OBB(baseLock.transform.position, baseLock.transform.rotation, baseLock.transform.GetBounds()));

            // If Player has building Auth, Allow them to use CodeLock.
            if (isBuildingAuthed)
            {
                return(true);
            }

            return(null);
        }
コード例 #8
0
        // Check for our switch lock, block pickup
        private object CanPickupLock(BasePlayer player, BaseLock baseLock)
        {
            if (baseLock == null)
            {
                return(null);
            }
            if (player == null)
            {
                return(null);
            }

            BaseEntity eswitch = baseLock.GetParentEntity();

            if (eswitch == null)
            {
                return(null);
            }

            if (eswitch.name.Contains("switch") && IsOurSwitch(eswitch.net.ID))
            {
#if DEBUG
                Puts("CanPickupLock: player trying to remove lock from a locked switch!");
#endif
                Message(player.IPlayer, "cannotdo");
                return(false);
            }
            if (eswitch.name.Contains("fuel_gen") && IsOurSwitch(eswitch.net.ID))
            {
#if DEBUG
                Puts("CanPickupLock: player trying to remove lock from a locked generator!");
#endif
                Message(player.IPlayer, "cannotdo");
                return(false);
            }
            return(null);
        }