Exemple #1
0
        private void UnequipItem(InventoryItemInstance item, bool postMessage)
        {
            if (!item.Equipped)
            {
                throw new InvalidOperationException();
            }

            EquipSlot slot = InventoryModel.GetItemSlot(item.ItemModel);

            if (slot != EquipSlot.None)
            {
                Equipped.Remove(slot);
            }
            //allow continuing even if it's not actually equippable, for fixing bugs

            //magazine logic
            if (item.ItemModel is RangedWeaponItemModel rwim && rwim.UseMagazine)
            {
                Inventory.AddItem(rwim.AType.ToString(), AmmoInMagazine[slot]);
                AmmoInMagazine[slot] = 0;
            }

            item.Equipped = false;

            UpdateStats();

            if (postMessage)
            {
                QdmsMessageBus.Instance.PushBroadcast(new QdmsKeyValueMessage("RpgChangeWeapon", "Slot", slot));
            }
        }
Exemple #2
0
 // Unequip a worn item
 public void Unequip(Item thing)
 {
     Equipped.Remove(thing);
 }