Пример #1
0
        private void InventoryChanged(User obj)
        {
            Inventory inventory = GetComponent <PublicStorageComponent>().Storage;
            User      owner     = OwnerUser;
            User      creator   = Creator;

            if (owner == null && creator == null)
            {
                return;
            }
            if (owner == null)
            {
                owner = creator;
            }
            if (creator == null)
            {
                creator = owner;
            }


            if (!SkillUtils.UserHasSkill(owner, RequiredSkill, RequiredLevel) && (!SkillUtils.UserHasSkill(creator, RequiredSkill, RequiredLevel)))
            {
                if ((inventory.TotalNumberOfItems(typeof(RuinedCarcassItem)) == 0) && (!inventory.IsEmpty))
                {
                    InventoryChangeSet changes = new InventoryChangeSet(inventory);
                    changes.Clear();
                    changes.AddItem <RuinedCarcassItem>();
                    Result result = changes.TryApply();
                }
            }
        }
Пример #2
0
 public override bool IsAuthorized(User user)
 {
     if ((user == null) || (reqskilltype == null))
     {
         return(base.IsAuthorized(user));
     }
     if (base.IsAuthorized(user) && SkillUtils.UserHasSkill(user, reqskilltype, reqskilllevel))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }