Exemple #1
0
 public override bool onPickup(Item obj, ShapeBase user, int amount)
 {
     if (base.onPickup(obj, user, amount))
         {
         Audio.AudioServerPlay3D("AmmoPickupSound", user.getTransform());
         return true;
         }
     return false;
 }
 public virtual bool onPickup(Item obj, ShapeBase user, int amount)
 {
     // Invoked when the user attempts to pickup this datablock object.
     // The %amount argument is the space in the user's inventory for
     // this type of datablock.  This method is responsible for
     // incrementing the user's inventory is something is addded.
     // Should return true if something was added to the inventory.
     return false;
 }
        public override bool onPickup(Item obj, ShapeBase user, int amount)
        {
            if (!base.onPickup(obj, user, amount))
                return false;

            Audio.AudioServerPlay3D("WeaponPickupSound", user.getTransform());

            ShapeBaseImageData image = user.getMountedImage(Constants.WeaponSlot);

            if (image == 0)
                return false;

            if (!console.isField(image, "clip") || image["clip"].getID() != getId())
                return false;

            bool outOfAmmo = !user.getImageAmmo(Constants.WeaponSlot);

            int amountInClips = 0;

            int currentAmmo = user.getInventory(image["ammo"]);

            if (console.isObject(image["clip"]))
                amountInClips = user.getInventory(image["clip"]);

            int t = console.GetVarInt(string.Format("{0}.ammo.maxInventory", image));

            amountInClips *= t;

            int amountloadedingun = console.GetVarInt(string.Format("{0}.remaining{1}", obj, console.GetVarString(string.Format("{0}.ammo", this))));

            amountInClips += amountloadedingun;

            GameConnection client = user["client"];
            client.setAmmoAmountHud(currentAmmo, amountInClips);

            if (outOfAmmo)
                ((WeaponImage) image.ID).onClipEmpty(user, Constants.WeaponSlot);

            return true;
        }
Exemple #4
0
        public override bool onPickup(Item obj, ShapeBase user, int amount)
        {
            if (!base.onPickup(obj, user, amount))
                return false;
            Audio.AudioServerPlay3D("WeaponPickupSound", user.getTransform());

            //todo do really like this, I guess they didn't want aiPlayer picking shit up.
            if (user.getClassName() == "Player" && user.getMountedImage(Constants.WeaponSlot) == 0)
                return user.Use(this);

            return false;
        }