// --------------------------------------------------------------------------
//
// Famas (Weapon)
//
// --------------------------------------------------------------------------


//Weapon Auxiliar
Actor FamaswillBurst: Inventory
{
Inventory.MaxAmount 1
}

ACTOR "Famas" : CSDMOWeapon //5010
{
	Weapon.SisterWeapon Famas_rat

+AMMO_OPTIONAL

	Weapon.SelectionOrder 200
  weapon.ammotype "FamasClip"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "556mmAmmo"
  weapon.ammouse2 0
  weapon.ammogive2 0 //25
	obituary "%k killed %o with Famas."
	+WEAPON.WIMPY_WEAPON
	Inventory.Pickupmessage "Picked up a Famas."
	Tag "Famas"
	Weapon.UpSound "Famas/Ready"
	//AttackSound "Famas/Fire" 
	Scale 0.15
//	+NOAUTOFIRE

	States
	{
	Ready:
		W10E D 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("IsBot",1,"BotReady")
	TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")
		Loop
		
		

		
		

	ToBurst:
	TNT1 A 0 A_JumpIfInventory("FamasWillBurst", 1, "ToSingle")
        TNT1 A 0 A_Playsound("Function/Alternate")
	  SCOP A 0 A_GiveInventory("FamaswillBurst", 1)
	TNT1 A 0 A_Print("Switched to Burst fire")
	ToBurst_Hold:
		W10E D 10 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_Refire("ToBurst_Hold")
		Goto Ready
		


	ToSingle:
	  TNT1 A 0 A_TakeInventory("FamasWillBurst", 1)
        TNT1 A 0 A_Playsound("Function/Alternate")
	TNT1 A 0 A_Print("Switched to Full-Auto")
	ToSingle_Hold:
		W10E D 10 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_Refire("ToSingle_Hold")
		Goto Ready
		
		


	Deselect:
	TNT1 A 0 ACS_NamedExecuteAlways("HSPreviousWeapon", 0, 2, 0, 0)
    TNT1 A 1 
	Goto DeselectLoop		
		
	Select:
	TNT1 A 1 A_Raise
	TNT1 AA 0 A_Raise
	TNT1 A 0 ACS_ExecuteAlways(798, 0, 220, 0, 0)//Weapon Weight
	TNT1 A 1 A_TakeInventory("CrosshairType",2)

	TNT1 A 0 ACS_NamedExecuteAlways("HSPreviousWeapon", 0, 1, 0, 0)
	    TNT1 A 0 A_JumpIfInventory("RAT_Trigger",1,"RAT_TriggerSelect")

	TNT1 A 1 A_WEAPONREADY(WRF_NOFIRE)
		W10A DEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W10B ABCDEFGHIJK 1 A_WEAPONREADY(WRF_NOFIRE)
		TNT1 A 0 A_JumpIfInventory("Fire_Holdkey",1,"Fire")//A_Refire
		Goto Ready

	Rat_TriggerSelect:
    TNT1 A 0 A_TakeInventory("Rat_Trigger",1)

	TNT1 A 1 A_WEAPONREADY(WRF_NOFIRE)
		W10A DEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W10B ABCDEFGHIJK 1 A_WEAPONREADY//WRF_NOFIRE)
		TNT1 A 0 A_JumpIfInventory("Fire_Holdkey",1,"Fire")//A_Refire
		Goto Ready		
		
	Fire:

	W10E K 0 A_JumpIfNoAmmo("AltFire")
	TNT1 A 0 A_JumpIfInventory("Famaswillburst", 1, "FireBurst")
	
		W10D A 1 A_GunFlash
		W10D B 1 A_WEAPONREADY(WRF_NOFIRE)
		W10D C 1 A_WEAPONREADY(WRF_NOFIRE)

//		TNT1 A 0 A_JumpIfInventory("Fire_Holdkey",1,"Fire")//A_Refire
		TNT1 A 0 A_Refire
		W10D D 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D E 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D F 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D G 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D H 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D I 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D J 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D K 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D L 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D M 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D N 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D O 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D P 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D Q 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D R 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D S 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D T 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D U 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D V 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D W 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D X 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D Y 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10D Z 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")
		


		W10E A 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10E B 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10E C 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10E D 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")
		
		Goto Ready



	FireBurst:

	W10E K 0 A_JumpIfNoAmmo("AltFire")	
		W10F A 1 A_GunFlash("FlashBurst")//1
TNT1 A 0 A_SetPitch(pitch-1.62)//-1.82
TNT1 A 0 A_SetANgle(angle+0.75)
TNT1 A 0 A_SetANgle(angle-0.45)
		W10F B 4 A_WEAPONREADY(WRF_NOFIRE)//1
	//W10E K 0 A_JumpIfNoAmmo("AltFire")	
		//W10F C 0 A_GunFlash("FlashBurst")//1
//TNT1 A 0 A_SetPitch(pitch-0.92)
//TNT1 A 0 A_SetANgle(angle+0.65)
//TNT1 A 0 A_SetANgle(angle-0.35)
		//W10F D 0 A_WEAPONREADY(WRF_NOFIRE)//1
	//W10E K 0 A_JumpIfNoAmmo("AltFire")	
		//W10F E 0 A_GunFlash("FlashBurst")//1
//TNT1 A 0 A_SetPitch(pitch-1.54)
//TNT1 A 0 A_SetANgle(angle+0.65)
//TNT1 A 0 A_SetANgle(angle-0.35)
		//W10F F 0 A_WEAPONREADY(WRF_NOFIRE)//1 *
		//TNT1 A 0 A_Refire
		//W10F GHIJKLMNOPQR 1 A_WeaponReady(WRF_NOFIRE)//1
		TNT1 A 0 A_JumpIfInventory("Fire_Holdkey",1,"Fire")//A_Refire 0
		TNT1 A 0 A_Refire
		

		W10F S 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10F T 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10F U 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10F V 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10F W 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10F X 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10F Y 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10F Z 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")
		
		
		W10G A 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10G B 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10G C 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10G D 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10G E 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10G F 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10G G 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10G H 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10G I 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		W10G J 1 A_WEAPONREADY
        TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToBurst")

		Goto Ready







//Bot compatibility

	BotReady:
		
		W10E D 1 A_WeaponReady
		TNT1 A 0 A_REFIRE
		Loop


	BotFire:
		W10D A 1 A_GunFlash
		W10D B 1 A_WEAPONREADY(WRF_NOFIRE)
		W10D C 1 A_WEAPONREADY(WRF_NOFIRE)
		W10D DEFGHIJKLMNOPQRSTUVWXYZ 1 A_Refire
		W10E ABCD 1 A_Refire
		Goto Ready




  Altfire:
    TNT1 A 0 A_JumpIfInventory("FamasClip",25,"Ready")
    TNT1 A 0 A_JumpIfInventory("556mmAmmo",1,"ReloadStart")
    goto Ready


	ReloadStart:
		W10H ABCDEFGHIJKLMNOPQRS 1 A_WEAPONREADY(WRF_NOFIRE)
		TNT1 A 0 A_PlaySound("Famas/Reload", 6)
W10H TUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W10I ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W10J ABCDEFGHIJKLMNO 1 A_WEAPONREADY(WRF_NOFIRE)
		
		Goto ReloadAmmo
	
	
  ReloadAmmo:
    TNT1 A 0 A_GiveInventory("FamasClip",1)
    TNT1 A 0 A_TakeInventory("556mmAmmo",1)
    TNT1 A 0 A_JumpIfInventory("FamasClip",0,"ReloadEnd")
    TNT1 A 0 A_JumpIfInventory("556mmAmmo",1,"ReloadAmmo")
    goto ReloadEnd		

	ReloadEnd:
		
		W10J PQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W10K ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W10L ABCDEFGHIJKLMN 1 A_WEAPONREADY(WRF_NOFIRE) //1
//		TNT1 A 0 A_JumpIfInventory("Fire_Holdkey",1,"Fire")//A_Refire
		Goto Ready




	Flash:
	TNT1 A 0 ACS_ExecuteAlways(799, 0, 0, 0, 0)
	TNT1 A 0 A_GiveInventory("CrosshairGrow", 7)
	    TNT1 A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,15,-1)
TNT1 A 0 A_PlaySound ("Famas/FIRE")
		TNT1 A 0 A_PlaySound("FAMAS/Distant", 7)
		TNT1 A 0 Bright A_Light1
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("RifleCaseSpawn",5,0,12,-6)
        TNT1 A 0 BRIGHT A_FireCustomMissile("Tracer", frandom(-2.5,2.5), 0, 11, 0, 0, frandom(-2.5,2.5))
		TNT1 A 2 A_FireBullets(0.35, 0.35, 1, 152.0, "FamasBullet")//8.15
TNT1 A 0 A_SetPitch(pitch-1.66)//-2.02
TNT1 A 0 A_SetANgle(angle+0.75)
TNT1 A 0 A_SetANgle(angle-0.45)
		Goto LightDone

	FlashBurst:
	TNT1 A 0 ACS_ExecuteAlways(799, 0, 0, 0, 0)
	TNT1 A 0 A_GiveInventory("CrosshairGrow", 7)
	    TNT1 A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,15,-1)
TNT1 A 0 A_PlaySound ("Famas/FIRE")
		TNT1 A 0 A_PlaySound("FAMAS/Distant", 7)
		TNT1 A 0 Bright A_Light1
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("RifleCaseSpawn",5,0,12,-6)
        TNT1 A 0 BRIGHT A_FireCustomMissile("Tracer", frandom(-1.5,1.5), 0, 11, 0, 0, frandom(-1.5,1.5))
		TNT1 A 2 A_FireBullets(0.1, 0.1, 1, 152.0, "FamasBullet")//8.15
		Goto LightDone

 	Spawn:
		W10Z A -1
		Stop
	}
}