Example #1
0
        private bool VerifyNoLockRestriction(IPlayer player, BaseCombatEntity vehicle)
        {
            var basePlayer = player.Object as BasePlayer;
            var baseLock   = vehicle.GetSlot(BaseEntity.Slot.Lock);

            if (baseLock == null || baseLock.OwnerID == basePlayer.userID)
            {
                return(true);
            }

            ReplyToPlayer(player, "Claim.Error.LockedByAnother");
            return(false);
        }
Example #2
0
        // checks for a lock
        object CheckLock(BaseCombatEntity entity, HitInfo hitinfo)
        {
            // exclude deployed items in storage container lock check (since they can't have locks)
            if (entity.ShortPrefabName == "lantern.deployed" ||
                entity.ShortPrefabName == "ceilinglight.deployed" ||
                entity.ShortPrefabName == "furnace.large" ||
                entity.ShortPrefabName == "campfire" ||
                entity.ShortPrefabName == "furnace" ||
                entity.ShortPrefabName == "refinery_small_deployed" ||
                entity.ShortPrefabName == "waterbarrel" ||
                entity.ShortPrefabName == "jackolantern.angry" ||
                entity.ShortPrefabName == "jackolantern.happy" ||
                entity.ShortPrefabName == "repairbench_deployed" ||
                entity.ShortPrefabName == "researchtable_deployed" ||
                entity.ShortPrefabName.Contains("shutter"))
            {
                return(null);
            }

            // if unlocked damage allowed - check for lock
            BaseLock alock = entity.GetSlot(BaseEntity.Slot.Lock) as BaseLock;             // get lock

            if (alock == null)
            {
                return(null);                 // no lock, allow damage
            }
            if (alock.IsLocked())             // is locked, cancel damage except heli
            {
                // if heliDamageLocked option is false or heliDamage is false, all damage is cancelled
                if (!data.config[Option.heliDamageLocked] || !data.config[Option.heliDamage])
                {
                    return(false);
                }
                object heli = CheckHeliInitiator(hitinfo);
                if (heli != null)
                {
                    return((bool)heli);
                }
                return(false);
            }
            return(null);
        }
Example #3
0
        void TryCopyLock(BaseCombatEntity lockableEntity, IDictionary <string, object> housedata)
        {
            var slotentity = lockableEntity.GetSlot(BaseEntity.Slot.Lock);

            if (slotentity != null)
            {
                if (slotentity.GetComponent <CodeLock>())
                {
                    housedata.Add("codelock", codelock.GetValue(slotentity.GetComponent <CodeLock>()).ToString());
                }
                else if (slotentity.GetComponent <KeyLock>())
                {
                    var code = (int)keycode.GetValue(slotentity.GetComponent <KeyLock>());
                    if ((bool)firstKeyCreated.GetValue(slotentity.GetComponent <KeyLock>()))
                    {
                        code |= 0x80;
                    }
                    housedata.Add("keycode", code.ToString());
                }
            }
        }
Example #4
0
        void OnEntityTakeDamage(BaseCombatEntity entity)
        {
            var @lock = entity.GetSlot(0);

            if (@lock != null && @lock.IsLocked())
            {
                if (usepermission)
                {
                    List <ulong> whitelisted = codelockwhitelist.GetValue(@lock) as List <ulong>;

                    if (whitelisted.Count >= 1)
                    {
                        if (permission.UserHasPermission(whitelisted[0].ToString(), "visionlocks.allow"))
                        {
                            entity.lastDamage = 0;
                        }
                    }
                }
                else
                {
                    entity.lastDamage = 0;
                }
            }
        }
Example #5
0
 void TryCopyLock(BaseCombatEntity lockableEntity, IDictionary<string, object> housedata)
 {
     var slotentity = lockableEntity.GetSlot(BaseEntity.Slot.Lock);
     if (slotentity != null)
     {
         if (slotentity.GetComponent<CodeLock>())
         {
             housedata.Add("codelock", codelock.GetValue(slotentity.GetComponent<CodeLock>()).ToString());
         }
         else if (slotentity.GetComponent<KeyLock>())
         {
             var code = (int)keycode.GetValue(slotentity.GetComponent<KeyLock>());
             if ((bool)firstKeyCreated.GetValue(slotentity.GetComponent<KeyLock>()))
                 code |= 0x80;
             housedata.Add("keycode", code.ToString());
         }
     }
 }