    	
#include "scripts/common.txt"

/*
==============================================================
TurokRifle
==============================================================
*/

final class TurokAKsu : TurokWeapon
{   
    int playerWeapon;
	
    TurokAKsu(kWeapon @actor)
    {
	
        super(actor);
		
		playerWeapon = -1;
		
		uint16 buttons = Player.Buttons();
	    
	    if(self.AnimState().PlayingID() != anim_weaponIdle|anim_weaponWalk|anim_weaponRun|anim_weaponFireLoop|anim_weaponFire)
		{
			if((buttons & BC_FORWARD) != 0)
			{
				Game.PrintLine("TOliveIStoDIEe", 0);
			
				if(playerWeapon != Player.CurrentWeapon())
				{
					playerWeapon = Player.CurrentWeapon();
			
					switch(playerWeapon)
					{
					case 15:
						Game.PrintLine("TOliveIStoDoubleDIE", 0);
						Player.GiveWeapon(TW_WEAPON_CHRONO, 3);
					}
					
					Player.GiveWeapon(TW_WEAPON_CHRONO, 3);
				}
			}
			else
			{
				return;
			}
		}
    }
    
    /*
    ==============================================================
    OnBeginFire
    ==============================================================
    */
    
    void OnBeginFire(void)
    {
	
	
		int playerWeapon;
		
		playerWeapon = -1;
		
		uint16 buttons = Player.Buttons();
	    
	    if(self.AnimState().PlayingID() != anim_weaponIdle|anim_weaponWalk|anim_weaponRun|anim_weaponFireLoop|anim_weaponFire)
		{
			if((buttons & BC_FORWARD) != 0)
			{
				Game.PrintLine("TOliveIStoDIEe2", 0);
			
				if(Player.HasWeapon(TW_WEAPON_PISTOL))
				{
					playerWeapon = Player.CurrentWeapon();
			
					switch(playerWeapon)
					{
					case 15:
						Game.PrintLine("TOliveIStoDoubleDIE2", 0);
						Player.GiveWeapon(TW_WEAPON_CHRONO, 3);
					}
					
					Player.GiveWeapon(TW_WEAPON_CHRONO, 3);
					
				}
			}
			else
			{
				return;
			}
		}
		else
		{
			return;
		}
    
        
        self.PlaySound("sounds/shaders/rifle_shot.ksnd");
        self.FireProjectile("fx/bullet_shell.kfx", 11.26f, 27.64f, -8.192f, true);
        self.FireProjectile("fx/weffect_assaultrifle.kfx", 5.12f+0.35f, 29.69f, -3.584f-0.5f);
        self.FireProjectile("fx/bullet.kfx", 10.24f, 25.6f, -10.24f);
        self.AnimState().Set(anim_weaponFireLoop, 0.7f, 0);   ///Put 11.0f, 0); for a default one and 0.6 or less to fire like hell
        self.RunFxEvent("GunFire");
        self.Owner().Actor().LoudNoiseAlert();
        self.Owner().Actor().RecoilPitch() = -0.02416609786450863f;
        self.Owner().ConsumeAmmo(1);
 
    }
}