ACTOR MiniGun : BrutalWeapon
{
	Game Doom
	SpawnID 28
	Weapon.SelectionOrder 700
	Weapon.AmmoType1 "Clip2"
	Weapon.AmmoGive 0
	Weapon.AmmoUse1 1
	+WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Inventory.PickupSound "CBOXPKUP"
	Inventory.PickupMessage "You got the Minigun!"
	Obituary "%o was mowed down by %k's Minigun."
	AttackSound "none"
	Scale 0.9
	States
	{
	Spawn:
		MGUN A 1
		MGUN A -1
		Stop
		
		 Ready: 
		 Ready3:
		  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")
		  CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			
		  CHAG A 0 A_JumpIfInventory("Spin",1,"Ready2")
		  CHAG A 0 A_JumpIfInventory("Clip2",1,"Ready")
		  Goto IdleNoAmmo
		  
		  IdleNoAmmo:
		  CHAE A 1 A_WeaponReady
		  CHAG A 0 A_TakeInventory ("Spin",1)
		  CHAG A 0 A_JumpIfInventory("Clip2",1,"Ready")
		  CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		  CHAG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		  CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		  Loop

		Ready2:
		  CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		  CHAG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		  CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		  CHAG ABCD 1 A_WeaponReady 
		  CHAG A 0 A_AlertMonsters
		  CHAG A 0 A_PlaySound("CHAINSPI", 5)
		  Loop
		  
	CheckSprint:
		CHAG A 1 A_WeaponReady(WRF_NOFIRE)
		CHAG A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		CHAG A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready
		
	StartSprint:
		CHAG A 1 A_WeaponReady(WRF_NOFIRE)
		CHAG A 0 A_Takeinventory("Zoomed",1)
		CHAG A 0 A_Takeinventory("ADSmode",1)
		CHAG A 0 A_ZoomFactor(1.0)
		CHAG A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
	Sprinting:	
		CHSP A 0 offset(-9,32) 
		CHAG A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		CHAG 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.
		CHAG A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		CHAG A 0 offset(-9,32) A_GiveInventory("UsedStamina", 9)
		CHAG A 0 offset(-9,32)
		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)
		CHAG A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        CHAG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		CHAG A 0 offset(-9,32) A_GiveInventory("UsedStamina", 9)
		CHAG A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		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)
		CHAG A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		CHAG A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint
		
	StopSprintTired:
		CHAG A 1
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		CHAG A 0 A_PlaySound("Tired", 2)
		CHAG A 0 A_TakeInventory("UsedStamina", 2)
		CHAG A 5 A_WeaponReady
		CHAG A 0 A_TakeInventory("UsedStamina", 2)
		CHAG A 5 A_WeaponReady
		CHAG A 0 A_TakeInventory("UsedStamina", 2)
		CHAG A 5 A_WeaponReady
		CHAG A 0 A_TakeInventory("UsedStamina", 2)
		CHAG A 5 A_WeaponReady
		CHAG A 0 A_TakeInventory("UsedStamina", 2)
		CHAG A 5 A_WeaponReady
		Goto Ready
	StopSprint:
		CHSP A 1
		CHAG A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready 

		Deselect:
			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)
			CHAG A 0 SetPlayerProperty(0,0,0)
			CHGS DCBA 1
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
			TNT1 A 1 A_Lower
			Wait

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

		NoAmmo:
			CHAE A 10 A_PlaySound("weapons/empty")
			Goto IdleNoAmmo
			
			
		Fire:
			CHAG A 0
			CHAG A 0 A_JumpIfInventory("Spin",1,"Hold")
			CHAG A 0 A_PlaySound("CHAINSTA", 5)
			CHAG A 0 BRIGHT A_FireCustomMissile("Alerter", 0, 0, 0, 0)
			CHAG BC 1
			CHAG D 1
			CHAG AB 1
			CHAG A 0 A_StopSound(5)
			//CHAG A 0 A_PlaySound("CHAINSPI", 5)
			CHAG A 0
		Hold:
			CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
			
			CHAG A 0 A_PlaySound("CHGNSHOT", 1)
			CHAG A 0 A_PlaySound("FARMGN", 5)
			CHAG A 0 A_ZoomFactor(0.98)
			
			CHAF A 1 BRIGHT A_FireBullets(5, 5, -1, 16, "MachineGunBulletPuff", FBF_NORANDOM | FBF_USEAMMO)

			CHAG A 0 A_Firecustommissile("50CaseSpawn",0,0,-12,-18)
			CHAG 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))
			CHAG A 0 A_ZoomFactor(1.0)
			CHAG A 0 A_JumpIfInventory("IsTacticalClass", 1, 2)//Tactical mode skips a frame, fires faster
			CHAF B 1
			CHAG A 0
			
			RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
			RIFG A 0 A_SetPitch(pitch-1.0)
			RIFG A 0
			
			CHAG A 0 A_PlaySound("CHGNSHOT", 1)
			CHAG A 0 A_PlaySound("FARMGN", 5)
			CHAG 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)
			CHAF C 1 BRIGHT A_FireBullets(5, 5, -1, 16, "MachineGunBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
			CHAG A 0 A_Firecustommissile("50CaseSpawn",0,0,-12,-18)
			CHAG A 0 A_SpawnItemEx("PlayerMuzzle3",30,5,27)
			CHAF A 0 BRIGHT A_FireCustomMissile("DecorativeTracer", random(-2,2), 0, 0, -12, 0, random(-2,2))
			CHAG A 0 A_ZoomFactor(1.0)
			CHAG A 0 A_JumpIfInventory("IsTacticalClass", 1, 2)//Tactical mode skips a frame, fires faster
			CHAF D 1
			CHAG A 0
			
			RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
			RIFG A 0 A_SetPitch(pitch-1.0)
			RIFG A 0
			
			
			MNGG B 0 A_ReFire
			CHAG A 0 A_PlaySound("MINIGEN", 5)
			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_PlaySound("CHAINSTO", 5)
		 CHAG A 1 A_WeaponReady
		
		 CHAG B 1 A_WeaponReady
		 CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		 CHAG A 0 A_Refire
		
		 CHAG C 1 A_WeaponReady
		 CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		 CHAG D 1 A_WeaponReady
				

		 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 1 A_WeaponReady
		 CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		 CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		 CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		
		 CHAG B 1 A_WeaponReady
		 CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		 CHAG C 2 A_WeaponReady
		
		 CHAG D 2 A_WeaponReady
		 CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		 CHAG A 0 A_JumpIfInventory("Spin",1,"Ready2") 
		 CHAG A 0 A_TakeInventory("Spin", 1)
		 CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		 CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		 CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		 CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		 CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		 
		 CHAG A 2 A_WeaponReady
		
		 CHAG B 2 A_WeaponReady
		 CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		 CHAG C 2 A_WeaponReady
		
		 CHAG D 2 A_WeaponReady
		 CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		 CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		 CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		 CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		 CHAG ABCD 2 A_WeaponReady
		 CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		 CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		 CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		 CHAG ABCD 3 A_WeaponReady
		 
		 goto Ready



	  AltFire:
		 
		 CHAG A 0 A_JumpIfInventory("Spin",1,"StopAlt")
		 CHAG A 0 A_GiveInventory ("Spin",1)
		 //CHAG A 0 SetPlayerProperty(0,1,0)
		  CHAG A 0 A_PlaySound("CHAINSTA", 5)
		  CHAG A 0 A_JumpIfInventory("Clip2",1,1)
		  Goto IdleNoAmmo
		 CHAG ABCD 2
		 CHAG A 0
		 Goto Ready2

	  StopAlt:
		CHAG A 0
		 CHAG A 0 A_TakeInventory ("Spin",1)
		 CHAG A 0 A_PlaySound("CHAINSTO", 6)
		 CHAG A 0 A_StopSound(5)
		 CHAG A 0 A_StopSound(1)
		 //CHAG A 0 SetPlayerProperty(0,0,0)
		 CHAG ABCD 1
		 CHAG ABCDABCD 2 A_WeaponReady
		 CHAG ABCD 3 A_WeaponReady
		 CHAG A 0
		 Goto Ready


		
		
		PuristGun:
			TNT1 A 1
			CHAG A 0 A_GiveInventory("ClassicChaingun", 1)
			CHAG A 0 A_TakeInventory("MiniGun", 1)
			TNT1 A 10
			Goto Ready2	
		
		
		
		}
}

