Exemple #1
0
        protected override void FireRangedWeapon()
        {
            var  cache     = _equipmentSlots[0].ItemCache;
            bool noconsume = false;

            if (ModdedPlayer.instance.ReusabilityChance >= 0 && Random.value < ModdedPlayer.instance.ReusabilityChance)
            {
                noconsume = true;
            }
            noconsume = noconsume || cache._maxAmount < 0 || RemoveItem(cache._ammoItemId, 1, false, true);
            if (noconsume && cache._ammoItemId == 231)
            {
                AddItem(231);
            }
            Multishot.Fired();
            this.StartCoroutine(RCoroutines.i.AsyncRangedFire(this, _weaponChargeStartTime, _equipmentSlots[0], _inventoryItemViewsCache[cache._ammoItemId][0], noconsume));

            _weaponChargeStartTime = 0f;
            float duration = (!noconsume) ? cache._reloadDuration : cache._dryFireReloadDuration;

            if (GreatBow.isEnabled)
            {
                duration *= 10;
            }
            SetReloadDelay(duration);
            _isThrowing = false;
        }
        protected override void FireRangedWeapon()
        {
            var cache = _equipmentSlots[0].ItemCache;

            if (EquippedModel == BaseItem.WeaponModelType.Polearm)
            {
                return;
            }
            bool noconsume = ModdedPlayer.Stats.perk_projectileNoConsumeChance >= 0 && Random.value < ModdedPlayer.Stats.perk_projectileNoConsumeChance;

            noconsume = noconsume || cache._maxAmount < 0 || RemoveItem(cache._ammoItemId, 1, false, true);
            if (noconsume && cache._ammoItemId == 231)
            {
                AddItem(231);
            }
            Multishot.Fired();
            COTFEvents.Instance.OnAttackRanged.Invoke();
            this.StartCoroutine(RCoroutines.i.AsyncRangedFire(this, _weaponChargeStartTime, _equipmentSlots[0], _inventoryItemViewsCache[cache._ammoItemId][0], noconsume));

            _weaponChargeStartTime = 0f;
            float duration = (!noconsume) ? cache._reloadDuration : cache._dryFireReloadDuration;

            if (GreatBow.isEnabled)
            {
                duration *= 10;
            }
            SetReloadDelay(duration);
            _isThrowing = false;
        }
Exemple #3
0
        private IEnumerator InitHandCoroutine()
        {
            while (ModReferences.rightHandTransform == null)
            {
                yield return(null);

                LocalPlayer.Inventory?.SendMessage("GetRightHand");
            }
            yield return(null);

            MoreCraftingReceipes.Initialize();

            //Multishot
            Multishot.localPlayerInstance = Multishot.Create(LocalPlayer.Transform, ModReferences.rightHandTransform);
            Multishot.localPlayerInstance.SetActive(false);

            //yield return null;
            //do
            //{
            //    if (LocalPlayer.Inventory.Owns(79))
            //        LocalPlayer.Inventory.Equip(79, false);

            //}
            //while (PlayerInventoryMod.originalBowModel == null);
        }
 // Use this for initialization
 void Start()
 {
     multishotScript = GetComponent <Multishot>();
     //ActivateMultishot();
     //ActivateLaser();
 }