public static BulletAttack.FalloffModel AddFalloffModel(FalloffDelegate falloffDelegate) { if (!loaded) { throw new CoreNotLoadedException(nameof(FalloffDelegate)); } delegates.Add(falloffDelegate); BulletAttack.FalloffModel ind = currentIndex++; if (hookApplied) { HooksCore.RoR2.BulletAttack.DefaultHitCallback.Il -= DefaultHitCallback_Il; } HooksCore.RoR2.BulletAttack.DefaultHitCallback.Il += DefaultHitCallback_Il; hookApplied = true; return(ind); }
private void Fire() { if (!this.hasFired) { this.hasFired = true; base.characterBody.AddSpreadBloom(1.5f); EffectManager.SimpleMuzzleFlash(Modules.Assets.muzzleFlashEnergy, base.gameObject, this.muzzleString, false); string soundString = "NemryShootGun"; if (this.isBoosted) { soundString = "NemryShootEnergy"; } Util.PlaySound(soundString, base.gameObject); if (base.isAuthority) { Ray aimRay = base.GetAimRay(); base.AddRecoil(-1f * ShootGun.recoil, -2f * ShootGun.recoil, -0.5f * ShootGun.recoil, 0.5f * ShootGun.recoil); LayerMask bulletStopperMask = LayerIndex.CommonMasks.bullet; float damageCoeff = ShootGun.damageCoefficient; BulletAttack.FalloffModel falloffModel = BulletAttack.FalloffModel.DefaultBullet; GameObject tracerPrefab = ShootGun.tracerEffectPrefab; if (this.isBoosted) { damageCoeff = ShootGun.boostedDamageCoefficient; bulletStopperMask = LayerIndex.world.mask; falloffModel = BulletAttack.FalloffModel.None; tracerPrefab = Modules.Assets.energyTracer; } new BulletAttack { bulletCount = 1, aimVector = aimRay.direction, origin = aimRay.origin, damage = damageCoeff * this.damageStat, damageColorIndex = DamageColorIndex.Default, damageType = DamageType.Generic, falloffModel = falloffModel, maxDistance = ShootGun.range, force = ShootGun.force, hitMask = LayerIndex.CommonMasks.bullet, minSpread = 0f, maxSpread = 0f, isCrit = base.RollCrit(), owner = base.gameObject, muzzleName = muzzleString, smartCollision = false, procChainMask = default(ProcChainMask), procCoefficient = procCoefficient, radius = 0.75f, sniper = false, stopperMask = bulletStopperMask, weapon = null, tracerEffectPrefab = tracerPrefab, spreadPitchScale = 0f, spreadYawScale = 0f, queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, hitEffectPrefab = EntityStates.Commando.CommandoWeapon.FirePistol2.hitEffectPrefab, }.Fire(); } } }