class StingerFire extends KFHighROFFire;

var transient float FireRateReminder;

//overrided to disable FlashEmitter attaching to Stinger
simulated function InitEffects()
{
    super(InstantFire).InitEffects();

    // don't even spawn on server
    if ( (Level.NetMode == NM_DedicatedServer) || (AIController(Instigator.Controller) != None) )
		return;
        
    if ( (ShellEjectClass != None) && ((ShellEjectEmitter == None) || ShellEjectEmitter.bDeleteMe) )
    {
        ShellEjectEmitter = Weapon.Spawn(ShellEjectClass);
        Weapon.AttachToBone(ShellEjectEmitter, ShellEjectBoneName);
    }

    // if ( FlashEmitter != None ) {
        // Weapon.AttachToBone(FlashEmitter, KFWeapon(Weapon).FlashBoneName);
    // }
}

event ModeDoFire()
{
    if ( Level.TimeSeconds - LastFireTime > 0.1 )
        FireRateReminder = 0;
    else
        FireRateReminder += fmax(Level.TimeSeconds - FireRate - LastFireTime, 0.f); // do precise fire rate
    
    super.ModeDoFire();
    
    if ( FireRateReminder > 0 ) {
        NextFireTime -= FireRateReminder;
        if ( NextFireTime < Level.TimeSeconds ) {
            FireRateReminder = Level.TimeSeconds - NextFireTime;
            NextFireTime = Level.TimeSeconds;
        }
    }
}

// simulated function HandleRecoil(float Rec)
// {
    // if ( FireRateReminder > 0.15 )
        // return; // additional shots
    
    // super.HandleRecoil(Rec);
// }

defaultproperties
{
     FireEndSoundRef="KF_BasePatriarch.Attack.Kev_MG_TurbineWindDown"
     AmbientFireSoundRef="HMG_S.Stinger.StingerPrimaryAmb"
     RecoilRate=0.012500
     maxVerticalRecoilAngle=65
     maxHorizontalRecoilAngle=65
     RecoilVelocityScale=0.000000
     ShellEjectClass=Class'ROEffects.KFShellEjectSCAR'
     ShellEjectBoneName="Stinger-CordFlap"
     NoAmmoSoundRef="HMG_S.M41A.DryFire"
     DamageType=Class'ScrnHMG.DamTypeStinger'
     DamageMin=35
     DamageMax=35
     Momentum=8500.000000
     PreFireAnim="WeaponFireStart"
     FireLoopAnim="WeaponFire"
     FireEndAnim="WeaponFireEnd"
     FireLoopAnimRate=1.500000
     FireRate=0.030000
     AmmoClass=Class'ScrnHMG.StingerAmmo'
     ShakeRotMag=(X=50.000000,Y=50.000000,Z=300.000000)
     ShakeRotRate=(X=7500.000000,Y=7500.000000,Z=7500.000000)
     ShakeRotTime=0.650000
     ShakeOffsetMag=(X=6.000000,Y=3.000000,Z=7.500000)
     ShakeOffsetRate=(X=1000.000000,Y=1000.000000,Z=1000.000000)
     ShakeOffsetTime=1.150000
     BotRefireRate=0.590000
     FlashEmitterClass=Class'ROEffects.MuzzleFlash1stSPSniper'
     aimerror=42.000000
     Spread=0.217500
     SpreadStyle=SS_Random
}
