ACTOR MiniGun : BrutalWeapon
{
	Game Doom
	SpawnID 28
	Weapon.SelectionOrder 700
	Weapon.AmmoType1 "Clip2"
	Weapon.AmmoGive 50
	Weapon.AmmoUse1 1
	+WEAPON.NOAUTOAIM
	+FORCEXYBILLBOARD
	Inventory.PickupSound "CBOXPKUP"
	Inventory.PickupMessage "$GOTCHAINGUN"
	Obituary "%o was mowed down by %k's Minigun."
	AttackSound "none"
	Scale 0.9
	DropItem "ChaingunSpawner"
	States
	{
	Spawn:
		MGUN A -1
		Stop

	Ready:
	Ready3:
		CHAG A 0 A_JumpIfInventory("Spin",1,"Ready2")
		CHAG A 0 A_JumpIfInventory("Clip2",1,1)
		Goto IdleNoAmmo
		CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		CHAG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		CHAG A 1 A_WeaponReady
		CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		CHAG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Loop

	IdleNoAmmo:
		CHAE A 1 A_WeaponReady
		CHAG A 0 A_TakeInventory ("Spin",1)
		CHAG A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		CHAG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		CHAG A 0 A_JumpIfInventory("IsRunning",1,"StartSprintNoAmmo")
		CHAG A 0 A_JumpIfInventory("Clip2",1,"Ready")
		Loop

	Ready2:
		CHAG A 0
		CHAG A 0 A_PlaySound("CHAINSPI", 5)
		CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		CHAG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		CHAG ABCD 1 A_WeaponReady
		CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		CHAG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint2")
		CHAG A 0 A_AlertMonsters
		Loop

	StartSprint:
		CHAG A 1 A_WeaponReady
		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:
		CHSP A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(0,38) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(3,36) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(6,34) A_SetPitch(pitch -0.5)
		CHSP A 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")

		CHSP A 1 offset(9,34) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(6,36) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(3,38) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(0,38) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		CHSP A 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")

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

	StartSprint2:
		CHAG A 1 A_WeaponReady
		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.

	Sprinting2:
		CHAG A 0 A_TakeInventory("Spin",1)
		CHAG A 0 A_PlaySound("CHAINSTO", 6)
		CHAG A 0 A_StopSound(5)
		CHSP A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(0,38) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(3,36) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(6,34) A_SetPitch(pitch -0.5)
		CHSP A 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")

		CHSP A 1 offset(9,34) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(6,36) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(3,38) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(0,38) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		CHSP A 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")

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

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

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

	StartSprintNoAmmo:
		CHAE A 1 A_WeaponReady
		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:
		CHSP A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(0,38) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(3,36) A_SetPitch(pitch -0.5)
		CHSP A 1 offset(6,34) A_SetPitch(pitch -0.5)
		CHSP A 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")

		CHSP A 1 offset(9,34) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(6,36) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(3,38) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(0,38) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		CHSP A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		CHSP A 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")

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

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

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

		Deselect:
			CHAG A 0
			CHAG A 0 A_JumpIfInventory("Spin",1,"SpinDeselect")
			CHAG A 0 A_TakeInventory ("Spin",1)
			CHAG A 0 A_TakeInventory("TossGrenade", 1)
			CHAG A 0 A_Takeinventory("HeavyAutomaticWeapon",1)
			CHAG A 0 A_TakeInventory("RandomHeadExploder", 1)
			TNT1 A 0 A_TakeInventory("Unloading", 1)
			TNT1 A 0 A_TakeInventory("Reloading", 1)
			TNT1 A 0 A_TakeInventory("StartDualWield",1)
			CHAG A 0 SetPlayerProperty(0,0,0)
			CHAG A 0 A_StopSound(5)
			CHGS DCBA 1
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
			TNT1 A 1 A_Lower
			Wait

		SpinDeselect:
			CHAG A 0
			CHAG A 0 A_TakeInventory ("Spin",1)
			CHAG A 0 A_TakeInventory("TossGrenade", 1)
			CHAG A 0 A_Takeinventory("HeavyAutomaticWeapon",1)
			CHAG A 0 A_TakeInventory("RandomHeadExploder", 1)
			TNT1 A 0 A_TakeInventory("Unloading", 1)
			TNT1 A 0 A_TakeInventory("Reloading", 1)
			TNT1 A 0 A_TakeInventory("StartDualWield",1)
			CHAG A 0 SetPlayerProperty(0,0,0)
			CHAG A 0 A_PlaySound("CHAINSTO", 5)
			CHGS DCBA 1
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
			TNT1 A 1 A_Lower
			CHAG A 0 A_StopSound(5)
			Wait

		Select:
			CHAG A 0
			CHAG 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)
			CHAG A 0 A_Takeinventory("HasBarrel",1)
			CHAG A 0 A_TakeInventory("TossGrenade", 1)
			CHAG A 0 A_PlaySound("CHGNPKUP")
			CHAG A 0 A_GunFlash
			CHGS AAAAAA 1 A_Raise
			TNT1 AAAAAA 0 A_Raise

		SelectAnimation:
			CHAG A 0
			CHGS ABCD 1 A_JumpIfInventory("GoFatality", 1, "Steady")
			Goto Ready

		NoAmmo:
			CHAE A 10 A_PlaySound("weapons/empty")
			Goto IdleNoAmmo

		Fire://Initial Wind-Up
			CHAG A 0
			CHAG A 0 A_JumpIfInventory("Spin",1,"Hold")
			RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, "Hold")//tactical mode has spin-up
			CHAG A 0 A_PlaySound("CHAINSTA", 5)
			CHAG A 0 A_FireCustomMissile("Alerter", 0, 0, 0, 0)
			CHAG BCD 4
			CHAG ABCD 3
			CHAG ABCD 2
			CHAG A 0 A_StopSound(5)
			CHAG A 0 A_JumpIfInventory("FiredPrimary",1,"Hold")
			CHAG A 0 A_PlaySound("CHAINSTO", 5)
			Goto SpinDown2
		Hold:
			RIFF A 0 A_FireCustomMissile("DistantFireSoundMachinegun", random(-1,1), 0, 0, -12, 0, random(-1,1))
			CHAG A 0 A_PlaySound("CHGNSHOT", 1)
			CHAF A 1 BRIGHT A_FireBullets(1.8, 1.9, -1, 16, "MachineGunBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
			TNT1 A 0 A_ZoomFactor(0.99)
			CHAG A 0 A_Firecustommissile("50CaseSpawn",0,0,-12,-16)
			CHAG A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
			CHAF A 0 A_FireCustomMissile("DecorativeTracer", random(-2,2), 0, 0, 0, 0, random(-2,2))
			CHAF B 1
			TNT1 A 0 A_ZoomFactor(1.0)
			RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
			RIFG A 0 A_SetPitch(pitch-0.4)

			RIFF A 0 A_FireCustomMissile("DistantFireSoundMachinegun", random(-1,1), 0, 0, -12, 0, random(-1,1))
			CHAG A 0 A_PlaySound("CHGNSHOT", 1)
			CHAF C 1 BRIGHT A_FireBullets(1.8, 1.9, -1, 16, "MachineGunBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
			TNT1 A 0 A_ZoomFactor(0.99)
			CHAG A 0 A_Firecustommissile("50CaseSpawn",0,0,-12,-16)
			CHAG A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
			CHAF A 0 A_FireCustomMissile("DecorativeTracer", random(-2,2), 0, 0, 0, 0, random(-2,2))
			CHAG A 0 A_JumpIfInventory("IsTacticalClass", 1, 2)//Tactical mode skips a frame, fires faster
			CHAF D 1
			TNT1 A 0 A_ZoomFactor(1.0)
			RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
			RIFG A 0 A_SetPitch(pitch-0.4)
			MNGG B 0 A_ReFire
			CHAG A 0 A_StopSound(5)
		SpinDown:
			CHAG A 0 A_JumpIfInventory("Spin",1,"Ready2")
			CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
			CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
			CHAG A 0 A_PlaySound("CHAINSTO", 5)
			CHAG ABCD 1 A_WeaponReady(WRF_NOFIRE)
			CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
			CHAG A 0 A_JumpIfInventory("FiredPrimary",1,"Hold")

			CHAG A 0 A_JumpIfInventory("Spin",1,"Ready2")
			CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
			CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
			CHAG AB 2 A_WeaponReady(WRF_NOFIRE)
			CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
			CHAG A 0 A_JumpIfInventory("FiredPrimary",1,"Hold")
			CHAG CD 2 A_WeaponReady(WRF_NOFIRE)
			CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
			CHAG A 0 A_JumpIfInventory("FiredPrimary",1,"Hold")
		SpinDown2://If they didn't hold the fire button
			CHAG A 0 A_JumpIfInventory("Spin",1,"Ready2")
			CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
			CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
			CHAG ABCD 3 A_WeaponReady(WRF_NOFIRE)
			CHAG A 0 A_JumpIfInventory("FiredPrimary",1,"Hold")

			CHAG A 0 A_JumpIfInventory("Spin",1,"Ready2")
			CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
			CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
			CHAG ABCD 4 A_WeaponReady
			CHAG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
			CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
			CHAG ABCD 5 A_WeaponReady
			CHAG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			goto Ready

	  AltFire:
		TNT1 A 0
		CHAG A 0 A_JumpIfInventory("Spin",1,"StopAlt")
		CHAG A 0 A_JumpIfInventory("Clip2",1,1)
		Goto IdleNoAmmo

		CHAG A 0 A_PlaySound("CHAINSTA", 5)
		CHAG BCD 4 A_WeaponReady(WRF_NOFIRE | WRF_NOSECONDARY)
		CHAG ABCD 3 A_WeaponReady(WRF_NOFIRE | WRF_NOSECONDARY)
		CHAG ABCD 2 A_WeaponReady(WRF_NOFIRE | WRF_NOSECONDARY)
		CHAG A 0 A_GiveInventory ("Spin",1)
		CHAG A 0 A_WeaponReady(WRF_NOSECONDARY)
		CHAG A 0 A_StopSound(5)
		Goto Ready2

	  StopAlt:
		CHAG A 0
		CHAG A 0 A_PlaySound("CHAINSTO", 6)
		CHAG A 0 A_StopSound(5)
		CHAG A 0 A_StopSound(1)

		CHAG ABCD 2 A_WeaponReady(WRF_NOSECONDARY)
		CHAG ABCD 3 A_WeaponReady(WRF_NOSECONDARY)
		CHAG ABCD 4 A_WeaponReady(WRF_NOSECONDARY)
		CHAG A 0 A_TakeInventory ("Spin",1)
		CHAG ABCD 5 A_WeaponReady(WRF_NOFIRE | WRF_NOSECONDARY)
		Goto Ready
		}
}