Ejemplo n.º 1
0
        public void SetArmor(InventoryObjectItem itm)
        {
            activeItems[2] = Inventory.IndexOf(itm);

            DestroyPhysicsModel();
            //TODO: SET NEW ARMOR FUNCTION - SHOULD THIS USE ATTACHMENTS OR NEW PLAYER MODEL??
        }
Ejemplo n.º 2
0
        public virtual VBItem DropItem(InventoryObjectItem i)
        {
            Inventory.Remove(i);

            if (i.Juice == 0)
            {
                return(null);
            }

            VBItem tmp = Entities.Instance.Create(i.ItemType, Map.Instance) as VBItem;

            tmp.Position = Position;

            MultipleActionItem matmp = tmp as MultipleActionItem;

            if (matmp != null)
            {
                matmp.ActionMode = i.ActionMode;

                ConsumableItem ctmp = tmp as ConsumableItem;
                if (ctmp != null)
                {
                    ctmp.Juice = i.Juice;
                }
            }

            tmp.PostCreate();
            tmp.PhysicsModel.Bodies[0].ClearForces();

            return(tmp);
        }
Ejemplo n.º 3
0
        public virtual bool SwapItem(InventoryObjectItem i, InventoryObject giver)
        {
            if (InvWeight() + i.ItemType.Weight <= GetMaxWeight())
            {
                return(false);
            }

            Inventory.Add(i);
            giver.Inventory.Remove(i);

            return(true);
        }
Ejemplo n.º 4
0
        public virtual void SetItem(InventoryObjectItem itm, bool bPrimary)
        {
            UpdateWeaponInfo();

            if (bPrimary)
            {
                activeItems[0] = Inventory.IndexOf(itm) + 1;
            }
            else
            {
                activeItems[1] = Inventory.IndexOf(itm) + 1;
            }

            UpdateCurrentItem();
        }
Ejemplo n.º 5
0
        public virtual bool TakeItem(VBItem i)
        {
            if (!CanHoldItem(i.Type))
            {
                return(false);
            }

            bool shouldAdd = true;

            //is it ammo and i already have one?
            if (i.Type as AmmoItemType != null)
            {
                InventoryObjectItem existing = Inventory.Find(search => search.ItemType == i.Type);
                if (existing != null)
                {
                    existing.Juice += (i as AmmoItem).Juice;
                    shouldAdd       = false;
                }
            }

            if (shouldAdd)
            {
                InventoryObjectItem tmp = new InventoryObjectItem();
                tmp.SetType(i.Type);

                ConsumableItem ctmp = i as ConsumableItem;
                if (ctmp != null)
                {
                    tmp.SetJuice(ctmp.Juice);

                    if (ctmp.Juice > 0)
                    {
                        VBWeaponItem wtmp = ctmp as VBWeaponItem;
                        if (wtmp != null)
                        {
                            tmp.AmmoType = wtmp.AmmoTypeLoaded;
                        }
                    }
                }

                Inventory.Add(tmp);
            }

            i.SetForDeletion(false);
            return(true);
        }
Ejemplo n.º 6
0
        public InventoryObjectItem GetAmmoFor(InventoryObjectItem wpn)
        {
            VBWeaponItemType asWeapon = wpn.ItemType as VBWeaponItemType;

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

            foreach (InventoryObject.InventoryObjectItem itm in Inventory)
            {
                AmmoItemType amType = itm.ItemType as AmmoItemType;
                if (amType != null && asWeapon.UsableAmmoList.Contains(amType))
                {
                    return(itm);
                }
            }

            return(null);
        }