ACTOR Machinegun : BrutalWeapon 
{
	Weapon.SelectionOrder 600
	Weapon.AmmoType1 "Clip2"
	Weapon.AmmoGive1 0
	Weapon.AmmoUse1 1
	Weapon.AmmoType2 "AmmoRocket"
	Weapon.AmmoGive2 0
	Weapon.AmmoUse2 1
	+WEAPON.NOAUTOAIM
	//+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	+WEAPON.ALT_AMMO_OPTIONAL
	Inventory.PickupSound "CBOXPKUP"
	Inventory.PickupMessage "You got the Machine Gun!"
	Obituary "%o was mowed down by %k's Machine Gun."
	AttackSound "none"
	Scale 0.7
	Tag "MachineGun"
	States
	{
	Spawn:
		MGN1 Z 1
		MGN1 Z -1
		Stop
		
		 Ready: 
		 Ready3:
		  MGN1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		  TNT1 A 0 ACS_NamedExecuteAlways("MGGrenadeCheck")
		  MGN1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		  MGN1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		  MGN1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		  MGN1 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		  MGN1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		  MGN1 A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		  MGN1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		  Loop	
		  //MGN1 A 0 A_JumpIfInventory("Clip2",1,"Ready")
		  //Goto IdleNoAmmo
		  
		  IdleNoAmmo:
		  MGN1 F 1 A_WeaponReady
		  MGN1 A 0 A_JumpIfInventory("Clip2",1,"Ready")
		  Loop

		  
	CheckSprint:
		MGN1 A 1 A_WeaponReady(WRF_NOFIRE)
		MGN1 A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		MGN1 A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready
		
	StartSprint:
		MGN1 A 1 A_WeaponReady(WRF_NOFIRE)
		MGN1 A 0 A_Takeinventory("Zoomed",1)
		MGN1 A 0 A_Takeinventory("ADSmode",1)
		MGN1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 ACS_NamedExecuteAlways("MGGrenadeCheck")
		MGN1 A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
	Sprinting:	
		MGN1 S 0 offset(-9,32) 
		MGN1 A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		MGN1 A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
		MGN1 A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		MGN1 A 0 offset(-9,32) A_GiveInventory("UsedStamina", 6)
		MGN1 A 0 offset(-9,32)
		MGN1 S 1 offset(-9,34) A_SetPitch(pitch -0.5)
		MGN1 S 1 offset(-6,36) A_SetPitch(pitch -0.5)
		MGN1 S 1 offset(-3,38) A_SetPitch(pitch -0.5)
		MGN1 S 1 offset(0,38) A_SetPitch(pitch -0.5)
		MGN1 S 1 offset(3,36) A_SetPitch(pitch -0.5)
		MGN1 S 1 offset(6,34) A_SetPitch(pitch -0.5)
		MGN1 S 1 offset(9,32) A_SetPitch(pitch -0.5)
		MGN1 A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		MGN1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        MGN1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        MGN1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		MGN1 A 0 offset(-9,32) A_GiveInventory("UsedStamina", 6)
		MGN1 A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		MGN1 S 1 offset(9,34) A_SetPitch(pitch +0.5)
		MGN1 S 1 offset(6,36) A_SetPitch(pitch +0.5)
		MGN1 S 1 offset(3,38) A_SetPitch(pitch +0.5)
		MGN1 S 1 offset(0,38) A_SetPitch(pitch +0.5)
		MGN1 S 1 offset(-3,36) A_SetPitch(pitch +0.5)
		MGN1 S 1 offset(-6,34) A_SetPitch(pitch +0.5)
		MGN1 S 1 offset(-9,32) A_SetPitch(pitch +0.5)
		TNT1 A 0 ACS_NamedExecuteAlways("MGGrenadeCheck")
		MGN1 A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		MGN1 A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint
		
	StopSprintTired:
		MGN1 A 1
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		MGN1 A 0 A_PlaySound("Tired", 2)
		MGN1 A 0 A_TakeInventory("UsedStamina", 2)
		MGN1 A 5 A_WeaponReady
		MGN1 A 0 A_TakeInventory("UsedStamina", 2)
		MGN1 A 5 A_WeaponReady
		MGN1 A 0 A_TakeInventory("UsedStamina", 2)
		MGN1 A 5 A_WeaponReady
		MGN1 A 0 A_TakeInventory("UsedStamina", 2)
		MGN1 A 5 A_WeaponReady
		MGN1 A 0 A_TakeInventory("UsedStamina", 2)
		MGN1 A 5 A_WeaponReady
		Goto Ready
	StopSprint:
		MGN1 S 1
		MGN1 A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready 

		Deselect:
			MGN1 A 0 A_TakeInventory ("Spin",1)
			MGN1 A 0 A_TakeInventory("TossGrenade", 1)
			MGN1 A 0 A_Takeinventory("HeavyAutomaticWeapon",1)
			MGN1 A 0 A_TakeInventory("RandomHeadExploder", 1)
			MGN1 A 0 SetPlayerProperty(0,0,0)
			MGS1 DCBA 1
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
			TNT1 A 1 A_Lower
			Wait

		Select:
			MGN1 A 0 A_Giveinventory("GoSpecial",1)
			MGN1 A 0 A_Giveinventory("HeavyAutomaticWeapon",1)
			MGN1 A 0 A_Takeinventory("FistsSelected",1)
			MGN1 A 0 A_Takeinventory("SawSelected",1)
			MGN1 A 0 A_Takeinventory("ShotgunSelected",1)
			MGN1 A 0 A_Takeinventory("SSGSelected",1)
			MGN1 A 0 A_Giveinventory("MinigunSelected",1)
			MGN1 A 0 A_Takeinventory("PlasmaGunSelected",1)
			MGN1 A 0 A_Takeinventory("RocketLauncherSelected",1)
			MGN1 A 0 A_Takeinventory("GrenadeLauncherSelected",1)
			MGN1 A 0 A_Takeinventory("BFGSelected",1)
			MGN1 A 0 A_Takeinventory("BFG10kSelected",1)
			MGN1 A 0 A_Takeinventory("RailGunSelected",1)
			MGN1 A 0 A_Takeinventory("SubMachineGunSelected",1)
			MGN1 A 0 A_Takeinventory("RevenantLauncherSelected",1)
			MGN1 A 0 A_Takeinventory("LostSoulSelected",1)
			MGN1 A 0 A_Takeinventory("FlameCannonSelected",1)
			MGN1 A 0 A_GiveInventory("RandomHeadExploder", 1)
			MGN1 A 0 A_Takeinventory("HasBarrel",1)
			MGN1 A 0 A_TakeInventory("TossGrenade", 1)
			MGN1 A 0 A_PlaySound("CHGNPKUP")
			MGS1 AAAAAA 1 A_Raise
			TNT1 AAAAAA 0 A_Raise
		
		SelectAnimation:
			MGN1 A 0
			MGN1 A 0 A_GunFlash
			MGS1 ABCD 1 A_JumpIfInventory("GoFatality", 1, "Steady")
			Goto Ready

		NoAmmo:
			CHAE A 10 A_PlaySound("weapons/empty")
			Goto IdleNoAmmo
		NoAmmo2:
			MGN1 A 1 A_PlaySound("weapons/empty")
			Goto Ready	
			
			
		Fire:
			MGN1 A 0
			MGN1 A 0 A_PlaySound("FARHMG", 6)
			MGN1 A 0 A_PlaySound("HMGFIRE", 1)
			MGN1 A 0 A_ZoomFactor(0.98)
			TNT1 A 0 ACS_NamedExecuteAlways("MGGrenadeCheck")
			//TNT1 AA 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
			//RIFF A 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 0, -5, 0, 0)
			MGN1 B 1 BRIGHT A_FireBullets(4, 4, -1, 20, "hITPuff", FBF_NORANDOM | FBF_USEAMMO)
			MGN1 A 0 A_SpawnItemEx("PlayerMuzzle2",30,5,27)
			CHAF A 0 BRIGHT A_FireCustomMissile("DecorativeTracer", random(-2,2), 0, 0, -12, 0, random(-2,2))
			MGN1 A 0 A_ZoomFactor(1.0)
			MGN1 A 0 A_Firecustommissile("50CaseSpawn2",random(-2,2),0,0,-12,-18)
			MGN1 DE 1
			
			RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
			RIFG A 0 A_SetPitch(pitch-2.0)
			RIFG A 0
			
			MGN1 A 0
			MGN1 A 0 A_PlaySound("FARHMG", 6)
			MGN1 A 0 A_PlaySound("HMGFIRE", 7)
			MGN1 A 0 A_ZoomFactor(0.98)
			//TNT1 AA 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
			//RIFF A 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 0, -5, 0, 0)
			MGN1 K 1 BRIGHT A_FireBullets(4, 4, -1, 20, "hITPuff", FBF_NORANDOM | FBF_USEAMMO)
			MGN1 A 0 A_SpawnItemEx("PlayerMuzzle2",30,5,27)
			CHAF A 0 BRIGHT A_FireCustomMissile("DecorativeTracer", random(-2,2), 0, 0, -12, 0, random(-2,2))
			MGN1 A 0 A_ZoomFactor(1.0)
			MGN1 A 0 A_Firecustommissile("50CaseSpawn2",random(-2,2),0,0,-12,-18)
			MGN1 DE 1

			
			MGN1 A 0 A_Refire
			goto Ready
			
			
		AltFire:
			MGN1 A 0
			MGN1 A 0 A_JumpIfInventory("AmmoRocket", 1, 1)
			Goto NoAmmo2
			MGN1 A 0 A_JumpIfInventory("FiredMGGrenade", 1, "ReloadGrenade")
			MGN1 A 0 A_PlaySound("weapons/firegrenade")
			TNT1 A 0 ACS_NamedExecuteAlways("MGGrenadeCheck")
			MGN1 A 0 A_FireCustomMissile("RedFlareSpawn",-5,0,0,0)
			TNT1 AAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-16,16), 0, -1, random(-9,9))
			MGN2 A 0 BRIGHT A_FireCustomMissile("ShortGrenade", 0, 1, 0, 0)
			MGN1 A 0 A_SetPitch(-5.0 + pitch)
			MGN1 A 0 A_Recoil(8)
			MGN2 BC 1 BRIGHT A_SetPitch(1.0 + pitch)
			MGN2 DEF 1 A_SetPitch(1.0 + pitch)
			MGN1 A 0 A_GiveInventory("FiredMGGrenade", 1)
			MGN1 A 10
			MGN1 A 0 A_Refire
			goto Ready
		Reload:
			MGN1 A 1
			MGN1 A 0 A_TakeInventory("Reloading", 1)
			MGN1 A 0 A_JumpIfInventory("FiredMGGrenade", 1, "ReloadGrenade")
			Goto Ready
		ReloadGrenade:	
		
			MGN1 A 0
			MGN2 GHIJJJJ 1
			MGN1 A 0 A_PlaySound("GRLLO1")
			MGN2 KLMLLL 1
			MGN2 NOPQ 1
			MGN2 Q 15
			MGN2 RST 1
			MGN1 A 0 A_PlaySound("insertshell")
			MGN2 UUWVVVXY 1
			MGN2 NMMMMMML 1
			MGN1 A 0 A_PlaySound("GRLLO2")
			MGN1 A 0 A_TakeInventory("FiredMGGrenade", 1)
			MGN2 JJJJIHG 1
			MGN1 A 0 A_Refire
			Goto Ready
		
		
		
		}
}

