ACTOR Machinegun : BrutalWeapon
{
	Weapon.SelectionOrder 800
	Weapon.AmmoType1 "Clip2"
	Weapon.AmmoGive1 50
	Weapon.AmmoUse1 1
	Weapon.AmmoType2 "AmmoRocket"
	Weapon.AmmoGive2 0
	Weapon.AmmoUse2 1
	+WEAPON.NOAUTOAIM
	+FORCEXYBILLBOARD
	+WEAPON.ALT_AMMO_OPTIONAL
	Inventory.PickupSound "CBOXPKUP"
	Inventory.PickupMessage "$GOTMG"
	Obituary "%o was mowed down by %k's Machine Gun."
	AttackSound "none"
	YScale 0.8
	XScale 1.0
	Tag "MachineGun"
	DropItem "MachinegunSpawner"
	States
	{
	Spawn:
		MGN1 Z -1
		Stop

	Ready:
	Ready3:
		MGN1 A 0 A_JumpIfInventory("Clip2",1,1)
		Goto IdleNoAmmo
		MGN1 AAAA 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")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		MGN1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		MGN1 A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Loop

	IdleNoAmmo:
		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 F 1 A_WeaponReady
		MGN1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		MGN1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		MGN1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		MGN1 A 0 A_JumpIfInventory("IsRunning",1,"StartSprintNoAmmo")
		MGN1 A 0 A_JumpIfInventory("Clip2",1,"Ready")
		Loop

	StartSprint:
		MGN1 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SHTN A 0 A_Takeinventory("Zoomed",1)
        SHTN A 0 A_ZoomFactor(1.0)
		SHTN A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_SetCrosshair(0)
		SHTN A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.

	Sprinting:
		MGN1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("MGGrenadeCheck")
		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 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")

		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 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")

		PLAY A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.
		SMGG A 0 A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint

	StopSprint:
		MGN1 S 0 A_JumpIfInventory("PowerStrength", 1, 2)
		MGN1 A 0 A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		MGN1 S 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		Goto Ready

	StopSprintTired:
		MGN1 S 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		MGN1 A 0 A_PlaySound("Tired", 2)
		Goto Ready

	StartSprintNoAmmo:
		MGN1 F 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SHTN A 0 A_Takeinventory("Zoomed",1)
        SHTN A 0 A_ZoomFactor(1.0)
		SHTN A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_SetCrosshair(0)
		SHTN A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.

	SprintingNoAmmo:
		MGN1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("MGGrenadeCheck")
		MGN1 F 1 offset(-9,34) A_SetPitch(pitch -0.5)
		MGN1 F 1 offset(-6,36) A_SetPitch(pitch -0.5)
		MGN1 F 1 offset(-3,38) A_SetPitch(pitch -0.5)
		MGN1 F 1 offset(0,38) A_SetPitch(pitch -0.5)
		MGN1 F 1 offset(3,36) A_SetPitch(pitch -0.5)
		MGN1 F 1 offset(6,34) A_SetPitch(pitch -0.5)
		MGN1 F 1 offset(9,32) A_SetPitch(pitch -0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")

		MGN1 F 1 offset(9,34) A_SetPitch(pitch +0.5)
		MGN1 F 1 offset(6,36) A_SetPitch(pitch +0.5)
		MGN1 F 1 offset(3,38) A_SetPitch(pitch +0.5)
		MGN1 F 1 offset(0,38) A_SetPitch(pitch +0.5)
		MGN1 F 1 offset(-3,36) A_SetPitch(pitch +0.5)
		MGN1 F 1 offset(-6,34) A_SetPitch(pitch +0.5)
		MGN1 F 1 offset(-9,32) A_SetPitch(pitch +0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")

		PLAY A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.
		SMGG A 0 A_JumpIfInventory("IsRunning", 1, "SprintingNoAmmo")
		Goto StopSprintNoAmmo

	StopSprintNoAmmo:
		MGN1 F 0 A_JumpIfInventory("PowerStrength", 1, 2)
		MGN1 A 0 A_JumpIfInventory("UsedStamina", 100, "StopSprintTiredNoAmmo")
		MGN1 F 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		Goto IdleNoAmmo

	StopSprintTiredNoAmmo:
		MGN1 F 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		MGN1 A 0 A_PlaySound("Tired", 2)
		Goto IdleNoAmmo

		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)
			TNT1 A 0 A_TakeInventory("Reloading", 1)
			TNT1 A 0 A_TakeInventory("Unloading", 1)
			TNT1 A 0 A_TakeInventory("StartDualWield",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)
			TNT1 A 0 A_TakeInventory("FistsSelected", 1)
			TNT1 A 0 A_TakeInventory("ShotgunSelected", 1)
			TNT1 A 0 A_GiveInventory("MinigunSelected", 1)
			TNT1 A 0 A_TakeInventory("SSGSelected", 1)
			TNT1 A 0 A_TakeInventory("RocketLauncherSelected", 1)
			TNT1 A 0 A_TakeInventory("GrenadeLauncherSelected", 1)
			TNT1 A 0 A_TakeInventory("PlasmaGunSelected", 1)
			TNT1 A 0 A_TakeInventory("RailGunSelected", 1)
			TNT1 A 0 A_TakeInventory("RevenantLauncherSelected", 1)
			TNT1 A 0 A_TakeInventory("SubMachineGunSelected", 1)
			TNT1 A 0 A_TakeInventory("BFG10KSelected", 1)
			TNT1 A 0 A_TakeInventory("BFGSelected", 1)
			TNT1 A 0 A_TakeInventory("FlameCannonSelected", 1)
			TNT1 A 0 A_TakeInventory("SawSelected", 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")
			MGN1 A 0 A_GunFlash
			MGS1 AAAAAA 1 A_Raise
			TNT1 AAAAAA 0 A_Raise

		SelectAnimation:
			MGN1 A 0
			MGS1 ABCD 1 A_JumpIfInventory("GoFatality", 1, "Steady")
			Goto Ready

		NoAmmo:
			MGN1 A 0
			MGN1 A 0 A_JumpIfInventory("Clip2",1,"NoAmmo2")
			MGN1 F 10 A_PlaySound("weapons/empty")
			Goto IdleNoAmmo

		NoAmmo2:
			MGN1 A 10 A_PlaySound("weapons/empty")
			Goto Ready

		Fire:
			MGN1 A 0
			RIFF A 0 A_FireCustomMissile("DistantFireSoundHMG", random(-1,1), 0, 0, -12, 0, random(-1,1))
			MGN1 A 0 A_PlaySound("HMGFIRE", 1)
			TNT1 A 0 ACS_NamedExecuteAlways("MGGrenadeCheck")
			MGN1 B 1 BRIGHT A_FireBullets(1.6, 1.7, -1, 20, "hITPuff", FBF_NORANDOM | FBF_USEAMMO)
			TNT1 A 0 A_ZoomFactor(0.99)
			MGN1 A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
			CHAF A 0 A_FireCustomMissile("DecorativeTracer", random(-2,2), 0, 0, 0, 0, random(-2,2))
			MGN1 A 0 A_Firecustommissile("50CaseSpawn2",0,0,8,-8)
			MGN1 D 1
			TNT1 A 0 A_ZoomFactor(1.0)
			MGN1 E 1
			RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
			RIFG A 0 A_SetPitch(pitch-0.4)

			CHAG A 0 A_JumpIfInventory("Clip2", 1, 1)
			Goto NoAmmo
			TNT1 AAAA 0
			RIFF A 0 A_FireCustomMissile("DistantFireSoundHMG", random(-1,1), 0, 0, -12, 0, random(-1,1))
			MGN1 A 0 A_PlaySound("HMGFIRE", 7)
			MGN1 K 1 BRIGHT A_FireBullets(1.6, 1.7, -1, 20, "hITPuff", FBF_NORANDOM | FBF_USEAMMO)
			TNT1 A 0 A_ZoomFactor(0.99)
			MGN1 A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
			CHAF A 0 A_FireCustomMissile("DecorativeTracer", random(-2,2), 0, 0, 0, 0, random(-2,2))
			MGN1 A 0 A_Firecustommissile("50CaseSpawn2",0,0,8,-8)
			RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
			RIFG A 0 A_SetPitch(pitch-0.4)
			MGN1 D 1
			TNT1 A 0 A_ZoomFactor(1.0)
			TNT1 A 0 A_JumpIfInventory("IsTacticalClass", 1, 2)//Tactical mode skips a frame, fires faster
			MGN1 E 1 A_WeaponReady(1)
			MGN1 A 0 A_Refire
			goto Ready

		AltFire:
			MGN1 A 0
			MGN1 A 0 A_JumpIfInventory("AmmoRocket", 1, 1)
			Goto NoAmmo
			MGN1 A 0 A_JumpIfInventory("FiredMGGrenade", 1, "ReloadGrenade")
			MGN1 A 0 A_PlaySound("weapons/firegrenade")
			TNT1 A 0 ACS_NamedExecuteAlways("MGGrenadeCheck")
			MGN2 B 1 BRIGHT
			MGN1 A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
			TNT1 AAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-16,16), 0, 0, 0, 0, random(-9,9))
			MGN2 A 0 BRIGHT A_FireCustomMissile("ShortGrenade", 0, 1, 0, 0)
			RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
			RIFG A 0 A_SetPitch(-1.0 + pitch)
			MGN1 A 0 A_SetPitch(-1.0 + pitch)
			MGN1 A 0 A_Recoil(1)
			TNT1 A 0 A_ZoomFactor(0.98)
			MGN2 C 1 BRIGHT A_SetPitch(0.2 + pitch)
			TNT1 A 0 A_ZoomFactor(1.0)
			MGN2 DEF 1 A_SetPitch(0.2 + pitch)
			MGN1 A 0 A_GiveInventory("FiredMGGrenade", 1)
			MGN1 A 10 A_SetPitch(0.2 + pitch)
			MGN1 A 0 A_Refire
			goto Ready
		Reload:
			MGN1 A 1
			MGN1 A 0 A_TakeInventory("Reloading", 1)
			MGN1 A 0 A_JumpIfInventory("AmmoRocket", 1, 1)
			Goto NoAmmo
			MGN1 A 0 A_JumpIfInventory("FiredMGGrenade", 1, "ReloadGrenade")
			Goto Ready

		ReloadGrenade:
			MGN1 A 0
			MGN2 GHIJ 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
			A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			MGN1 A 0 A_PlaySound("GRLLO1")
			MGN2 KLM 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
			A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			MGN2 M 4 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
			A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			MGN2 NOPQ 1
			MGN2 Q 8
			MGN2 RST 1
			MGN1 A 0 A_PlaySound("insertshell")
			MGN2 UWV 1
			MGN2 V 4
			MGN2 WUTPONM 1
			MGN1 A 0 A_PlaySound("GRLLO2")
			MGN1 A 0 A_TakeInventory("FiredMGGrenade", 1)
			MGN2 LKJ 1
			MGN2 J 4
			MGN2 IHG 1
			MGN1 A 0 A_Refire
			Goto Ready
		}
}