
/*
	//***Che
		A_JumpIfInventory("IsPlayer", 1,
			is used instead of
		A_JumpIf(true,
			and
		A_Jump(256,
			because in Zandronum multiplayer clientside
			the first one dows work
			while the other two do not
			resulting in Quad sound always
*/

ACTOR Shot_Gun : BrutalWeapon
{
	Game Doom
	SpawnID 27
	Weapon.SelectionOrder 1300
	Weapon.AmmoUse1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive1 0
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "AmmoShell"
	Weapon.AmmoType2 "ShotgunAmmo"
	Inventory.PickupMessage "$GOTSHOTGUN"
    Inventory.PickupSound "weapons/sgpump"
	Obituary "$OB_MPSHOTGUN"
    AttackSound "None"
    +WEAPON.NOALERT
    +WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Scale 0.9
	Tag "Shotgun"
	States
	{
		//***Che disabling player weapons for cutscenes and for the evacuation center
		HoldFire:
			SHTN B 0 offset(-100,32) A_JumpIfInventory("Zoomed",1,"NoAim")
			SHTN B 0 A_JumpIfInventory("Taunting",1,"Taunt")
			SHTN B 0 A_JumpIfInventory("Salute1", 1, "Salute")
			SHTN B 0 A_JumpIfInventory("Salute2", 1, "Salute")
			SHTN B 0 A_JumpIfInventory("Reloading",1,"Reload")
			SHTN B 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			SHTN B 1 offset(-100,32) A_WeaponReady(WRF_NOBOB | WRF_NOFIRE | WRF_ALLOWRELOAD)
			SHTN B 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire")
			Goto Ready		
		Spawn:
			SHTC A -1
			Stop
			
		Select:
			SHTN A 0 A_Giveinventory("GoSpecial",1)
			SHTN A 0 A_Takeinventory("FistsSelected",1)
			SHTN A 0 A_Takeinventory("sawSelected",1)
			SHTN A 0 A_Giveinventory("ShotgunSelected",1)
			SHTN A 0 A_Takeinventory("SSGSelected",1)
			SHTN A 0 A_Takeinventory("MinigunSelected",1)
			SHTN A 0 A_Takeinventory("PlasmaGunSelected",1)
			SHTN A 0 A_Takeinventory("RocketLauncherSelected",1)
			SHTN A 0 A_Takeinventory("GrenadeLauncherSelected",1)
			SHTN A 0 A_Takeinventory("BFGSelected",1)
			SHTN A 0 A_Takeinventory("BFG10kSelected",1)
			"----" A 0 A_Takeinventory("UnmakerSelected",1) //***Che
			"----" A 0 A_Takeinventory("MG42Selected",1) //***Che
			"----" A 0 A_Takeinventory("AxeSelected",1) //***Che
			
			"----" A 0 A_Takeinventory("DragonslayerSelected",1) //***Che
			"----" A 0 A_Takeinventory("SniperRifleSelected",1)
			"----" A 0 A_Takeinventory("ShotolverSelected",1)
			"----" A 0 A_Takeinventory("Shotolver2Selected",1)
			SHTN A 0 A_Takeinventory("RailGunSelected",1)
			SHTN A 0 A_Takeinventory("SubMachineGunSelected",1)
			SHTN A 0 A_Takeinventory("RevenantLauncherSelected",1)
			SHTN A 0 A_Takeinventory("LostSoulSelected",1)
			SHTN A 0 A_Takeinventory("FlameCannonSelected",1)
			SHTN A 0 A_Takeinventory("HasBarrel",1)
			SHTN A 0 A_TakeInventory("TossGrenade", 1)
			TNT1 AAAAAAAAA 0 A_Raise
			TNT1 AAAA 1 A_Raise

		SelectAnimation:
			TNT1 AAAA 0 A_JumpIfInventory("GoFatality", 1, "Steady")
			SHTN A 0 A_JumpIfInventory("IsPlayingAsPurist", 1, "PuristGun")
			SHSS ABCD 1 A_JumpIfInventory("GoFatality", 1, "Steady")
			SHTN A 0 A_PlaySound("weapons/sgpump")
			SHTN A 0 A_GunFlash

		Ready3:	
		Ready:	
			TNT1 A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
			SHTN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			SHTN A 0 A_JumpIfInventory("Taunting",1,"Taunt")
			SHTN A 0 A_JumpIfInventory("Reloading",1,"Reload")
			SHTN A 0 A_JumpIfInventory("Salute1", 1, "Salute")
			SHTN A 0 A_JumpIfInventory("Salute2", 1, "Salute")
			SHTN A 0 A_JumpIfInventory("Unloading",1,"Unload")
			SHTN A 0 A_JumpIfInventory("Zoomed",1,"REady2")
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		OkToFire:
			TNT1 A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
			SHTN A 1 A_WeaponReady(WRF_ALLOWRELOAD)
			SHTN A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
			SHTN A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			Goto Ready
			
			
		Ready2:
			TNT1 A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
			"----" A 0 A_GiveInventory ("PlayerIsFighting", 20) //***Che encourages the follower NPCs to get da fug out of your line of fire
			SHTN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			SHTN A 0 A_JumpIfInventory("Taunting",1,"Taunt")
			SHTN A 0 A_JumpIfInventory("Reloading",1,"Reload")
			SHTN A 0 A_JumpIfInventory("Salute1", 1, "Salute")
			SHTN A 0 A_JumpIfInventory("Salute2", 1, "Salute")
			SHTN A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
			SHTN A 0 A_JumpIfInventory("Unloading",1,"Unload")
			SHTN A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHT8 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
			Loop	
			
		
		Deselect:
			SHTN A 0
			SHTN A 0 A_Takeinventory("Zoomed",1)
			SHTN A 0 A_TakeInventory("TossGrenade", 1)
			SHTN A 0 A_Takeinventory("ADSmode",1)
			SHTN A 0 A_Takeinventory("UseShotgunStrap",1)
			SHTN A 0 A_ZoomFactor(1.0)
			SHSS DCBA 1
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
			TNT1 A 1 A_Lower
			Wait

			
		Fire:
			SHTN A 0 A_Takeinventory("Reloading",1)
			SHTN A 0 A_JumpIfInventory("Zoomed",1,"Fire2")
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,2)
			Goto NoAmmo
			TNT1 AAAA 0
			TNT1 A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
			SHTN A 0 A_ZoomFactor(0.96)
			SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, "Pump2")
			
				"----" A 0 A_JumpIfInventory("QPowerQuadDamage", 1, 2)
				"----" A 0 A_JumpIfInventory("IsPlayer", 1, 2)
				"----" A 0 A_PlaySound("quaddamage/echo", CHAN_7)
				"----" A 0 A_GiveInventory ("PlayerIsFighting", 150) //***Che encourages the follower NPCs to get da fug out of your line of fire
			
			SHTN A 0 A_AlertMonsters
			SHTN A 0 A_PlaySound("weapons/sg", 1)
			RIFF A 0 A_FireCustomMissile("DistantFireSoundShotgun", random(-1,1), 0, 0, -12, 0, random(-1,1))
			SHTN A 0
			SHTN A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
			TNT1 AAAAAAAAAAAAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-12,12), 0, -1, 0, 0, random(-9,9))
			TNT1 AAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles2", random(-12,12), 0, -1, 0, 0, random(-9,9))
			TNT1 AAAAA 0 A_FireCustomMissile("DecorativeTracer", random(-3,3), 0, 0, -12, 0, random(-3,3))
			SHTN A 0 A_Takeinventory("ShotgunAmmo",1)
			SHTN A 0 A_FireBullets (5, 1, 4, 13, "ShotgunPuff", FBF_NORANDOM)
			SHTN A 0 A_FireBullets (2.5, 2.5, 5, 13, "ShotgunPuff2", FBF_NORANDOM)
			//***Che: buffing it to shred at point blank range (kill a caco in 3 shots instead of 4)
			SHTN A 0 A_firebullets (0,0,1,12,"shotpuff",FBF_NORANDOM,150) // damage type "SSG"			
			SHTN A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 3)//Tactical Mode deals extra damage
			SHTN A 0 A_FireBullets (6, 3, 5, 13, "ShotgunPuff2", FBF_NORANDOM)
			SHTN A 0 A_SetPitch(pitch-10)
			SHTA AB 1 BRIGHT
			SHTN A 0 A_SetPitch(-6.0 + pitch)
			SHTN A 0 A_ZoomFactor(1.00)
			SHTA C 1 A_SetPitch(+1.0 + pitch)
			SHTA DE 1 A_SetPitch(+1.0 + pitch)
			SHTN A 1 A_SetPitch(+3.0 + pitch)
			SHTN A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, "Pump1")//Tactical Mode is slower to pump
			
			SHTN AAAAAA 1 A_SetPitch(pitch+0.6)
			Goto Pump1
			
		Pump1:	
			SHTN A 0
			SHTN A 0 A_GiveInventory ("Pumping", 1)
			SHTN A 0 A_GiveInventory ("GoSpecial", 1)

			SHTN BCDEFG 1
			SHTN A 0 A_FireCustomMissile("ShotCaseSpawn",40,0,-8,-26)
			SHTN A 0 A_WeaponReady(WRF_NOFIRE| WRF_NOBOB)//Allows quick switch
			SHTN H 1 A_PlaySound("weapons/sgpump", 3)
			SHTN A 0 A_JumpIfInventory("TurboReload", 1, "PumpNoReload")//Tactical Mode is slower to pump
			SHTN IJ 1 A_JumpIfInventory("Reloading",1,"InsertingShells")
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,5)
			SHTN A 0 A_JumpIfInventory("TurboReload", 1, 4)
			SHTN A 0 A_Giveinventory("ShotgunWasEmpty",1)
			SHTN A 0 A_JumpIfInventory("NoAutoReload", 1, 2)
			Goto InsertingShells
			TNT1 AA 0
			SHTN KL 1 A_JumpIfInventory("Reloading",1,"InsertingShells")
			SHTN KJIH 1 A_JumpIfInventory("Reloading",1,"InsertingShells")
			SHTN A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			SHTN A 0 A_Takeinventory("ShotgunWasEmpty",1)
			SHTN GFEDC 1 A_JumpIfInventory("Kicking",1,"DoKick")
			SHTN A 0 A_JumpIfInventory("Reloading",1,"InsertingShells")
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,2)
			SHTN A 0 A_JumpIfInventory("TurboReload", 1, "TurboReload")
			SHTN A 0
			Goto ReadyToFireAgain
	   
	   
	   Pump2:	
			SHTN A 0
			SHTN A 0 A_GiveInventory ("Pumping", 1)
			SHTN A 0 A_GiveInventory ("GoSpecial", 1)
			SHTN A 0 A_TakeInventory("Reloading", 1)
			SHTN A 0 A_Takeinventory("Zoomed",1)
			SHTN A 0 A_ZoomFactor(1.0)
			SHTN FG 1
			SHTN H 1 A_PlaySound("weapons/sgpump", 3)
			SHTN IJ 1
			SHTN KL 1
			SHTN KJIH 1
			SHTN A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			SHTN A 0 A_Takeinventory("ShotgunWasEmpty",1)
			SHTN GFEDC 1 A_JumpIfInventory("Kicking",1,"DoKick")
			Goto ReadyToFireAgain
	   
			
		ReadyToFireAgain:	
			//SHTN A 6 <-- Old frame
			SHTN A 1 Offset(10,36) // <-- New frames
			SHTN A 1 Offset(9,40) //
			SHTN A 1 Offset(4,40) //
			SHTN A 1 Offset(0,32) //
			SHTN A 0 A_Refire
			Goto Ready3
			
		Fire2:
			SHTN A 0 A_Takeinventory("Reloading",1)
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,1)
			Goto NoAmmo
			SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, "Pump2")
			
				"----" A 0 A_JumpIfInventory("QPowerQuadDamage", 1, 2)
				"----" A 0 A_JumpIfInventory("IsPlayer", 1, 2)
				"----" A 0 A_PlaySound("quaddamage/echo", CHAN_7)
				"----" A 0 A_GiveInventory ("PlayerIsFighting", 150) //***Che encourages the follower NPCs to get da fug out of your line of fire
			
			SHTN A 0 A_AlertMonsters
			SHTN A 0 A_PlaySound("weapons/sg", 1)
			SHTN A 0 A_SpawnItemEx("PlayerMuzzle1",30,0,45)
			SHTN A 0 A_FireBullets (5, 1, 4, 13, "ShotgunPuff", FBF_NORANDOM)
			SHTN A 0 A_FireBullets (2.5, 2.5, 5, 13, "ShotgunPuff2", FBF_NORANDOM)
			//***Che: buffing it to shred at point blank range (kill a caco in 3 shots instead of 4)
			SHTN A 0 A_firebullets (0,0,1,12,"shotpuff",FBF_NORANDOM,150) // damage type "SSG"			
			SHTN A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 3)//Tactical Mode deals extra damage
			SHTN A 0 A_FireBullets (6, 3, 5, 13, "ShotgunPuff2", FBF_NORANDOM)
			SHTN A 0 A_SetPitch(pitch-10)
			SHTN A 0
			RIFF A 0 A_FireCustomMissile("DistantFireSoundShotgun", random(-1,1), 0, 0, -12, 0, random(-1,1))
			TNT1 AAAAA 0 A_FireCustomMissile("DecorativeTracer", random(-5,5), 0, 0, 0, 0, random(-5,5))
			SHTN A 0 A_SetPitch(-10.0 + pitch)
			SHTN A 0 A_Takeinventory("ShotgunAmmo",1)
			SHT8 F 1 BRIGHT A_SetPitch(+2.0 + pitch)
			SHT8 GHIA 1 A_SetPitch(+2.0 + pitch)
		Pump3:
			SHT8 A 2	
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo", 1, 1)
			Goto NoAmmo3
			SHTN A 0 A_GiveInventory ("Pumping", 1)
			SHTN A 0 A_PlaySound("weapons/sgpump", 5)
			SHT8 JKLL 1
			SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, 1)
			SHTN A 0 A_FireCustomMissile("ShotCaseSpawn",40,0,14,0)
			SHTN A 0 A_TakeInventory("ShotgunWasEmpty", 1)
			SHT8 LKJ 1
			SHT8 A 1
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHTN A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")//If still pressing alt fire, it means its holding aim
			SHTN A 0 A_REfire
			Goto Ready2
		
		PumpNoReload:	
			SHTN IJ 1
			SHTN KL 1
			SHTN KJIH 1
			SHTN A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			SHTN A 0 A_Takeinventory("ShotgunWasEmpty",1)
			SHTN GFEDC 1 A_JumpIfInventory("Kicking",1,"DoKick")
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,2)
			SHTN A 0 A_JumpIfInventory("TurboReload", 1, "TurboReload")
			SHTN A 0
			Goto ReadyToFireAgain
		
		
		
		AltFire:
			SHTN A 0
			TNT1 A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
			SHTN A 0 A_Giveinventory("GoSpecial",1)
			SHTN A 0 A_JumpIfInventory("Zoomed",1,"NoAim")
			SHTN A 0 A_Giveinventory("Zoomed",1)
			SHTN A 0 A_ZoomFactor(1.2)
			SHTN A 0 A_Giveinventory("ADSmode",1)
			SHT8 ED 1
			SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, "Pump3")
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHT8 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHT8 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHT8 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHT8 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHT8 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHT8 A 2 A_WeaponReady(WRF_ALLOWRELOAD)
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHTN A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")
			Goto Ready2
			
		HoldAim:	
			TNT1 A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
			"----" A 0 A_GiveInventory ("PlayerIsFighting", 20) //***Che encourages the follower NPCs to get da fug out of your line of fire
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHT8 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHT8 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
			SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
			SHT8 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
			SHTN A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")
			
		NoAim:	
			TNT1 AAAAAA 0
			SHTN A 0 A_Takeinventory("Zoomed",1)
			SHTN A 0 A_ZoomFactor(1.0)
			SHTN A 0 A_Takeinventory("ADSmode",1)
			SHTN A 0 A_Giveinventory("GoSpecial",1)
			SHT8 DE 1
			Goto Ready
			
			
		CheckSprint:
			SHTN A 1 A_WeaponReady(WRF_NOFIRE)
			SHTN A 0 A_Takeinventory("Zoomed",1)
			SHTN A 0 A_ZoomFactor(1.0)
			SHTN A 0 A_Takeinventory("ADSmode",1)
			SHTN A 0 A_Giveinventory("GoSpecial",1)
			SHTN A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
			SHTN A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
			Goto Ready
			
		StartSprint:
			SHTN A 1 A_WeaponReady(WRF_NOFIRE)
			SHTN A 0 A_Takeinventory("Zoomed",1)
			SHTN A 0 A_Takeinventory("ADSmode",1)
			SHTN A 0 A_ZoomFactor(1.0)
			SHTN A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
			
		Sprinting:	
			STRN A 0 offset(-9,32) 
			SHTN A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
			SHTN 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.
			SHTN A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
			SHTN A 0 offset(-9,32) A_GiveInventory("UsedStamina", 5)
			SHTN A 0 offset(-9,32)
			STRN A 1 offset(-9,34) A_SetPitch(pitch -0.5)
			STRN A 1 offset(-6,36) A_SetPitch(pitch -0.5)
			STRN A 1 offset(-3,38) A_SetPitch(pitch -0.5)
			STRN A 1 offset(0,38) A_SetPitch(pitch -0.5)
			STRN A 1 offset(3,36) A_SetPitch(pitch -0.5)
			STRN A 1 offset(6,34) A_SetPitch(pitch -0.5)
			STRN A 1 offset(9,32) A_SetPitch(pitch -0.5)
			SHTN A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
			SHTN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			SHTN A 0 A_JumpIfInventory("Taunting",1,"Taunt")
			SHTN A 0 A_JumpIfInventory("Reloading",1,"Reload")
			SHTN A 0 offset(-9,32) A_GiveInventory("UsedStamina", 5)
			SHTN A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
			STRN A 1 offset(9,34) A_SetPitch(pitch +0.5)
			STRN A 1 offset(6,36) A_SetPitch(pitch +0.5)
			STRN A 1 offset(3,38) A_SetPitch(pitch +0.5)
			STRN A 1 offset(0,38) A_SetPitch(pitch +0.5)
			STRN A 1 offset(-3,36) A_SetPitch(pitch +0.5)
			STRN A 1 offset(-6,34) A_SetPitch(pitch +0.5)
			STRN A 1 offset(-9,32) A_SetPitch(pitch +0.5)
			SHTN A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
			SHTN A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
			
			Goto StopSprint
		StopSprintTired:
			SHTN A 1
			PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
			SHTN A 0 A_PlaySound("Tired", 2)
			SHTN A 0 A_TakeInventory("UsedStamina", 2)
			SHTN A 5 A_WeaponReady
			SHTN A 0 A_TakeInventory("UsedStamina", 2)
			SHTN A 5 A_WeaponReady
			SHTN A 0 A_TakeInventory("UsedStamina", 2)
			SHTN A 5 A_WeaponReady
			SHTN A 0 A_TakeInventory("UsedStamina", 2)
			SHTN A 5 A_WeaponReady
			SHTN A 0 A_TakeInventory("UsedStamina", 2)
			SHTN A 5 A_WeaponReady
			Goto Ready
		StopSprint:
			STRN A 1
			SHTN A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
			PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
			Goto Ready
		
		
		ReloadWithNoAmmoLeft:
		Reload:
			SHTN A 0
			SHTN A 0 A_TakeInventory("Reloading", 1)
			SHTN A 0 A_JumpIfInventory("AmmoShell", 1, 2)
			Goto NoAmmo
			SHTN A 0
			SHTN A 0 A_Takeinventory("Zoomed",1)
			SHTN A 0 A_ZoomFactor(1.0)
			SHTN A 1 A_WeaponReady
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",9,"OkToFire")
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo", 1, "ReloadNormally")//Check if there is a shell in the chamber
			SHTN A 0 A_GiveInventory("ShotgunWasEmpty", 1)//This means there is no shell in the chamber
		
		ReloadNormally:	
			SHTN A 0 A_JumpIfInventory("AmmoShell",1,1)//If there is no reserve ammo, don't reload, go back to Ready
			Goto Ready
			SHTN A 0 A_JumpIfInventory("TurboReload", 1, "TurboReload")//Check if reloads are disabled.
			SHTN B 1 A_GiveInventory ("Pumping", 1)
			SHTN CDE 1
			
		InsertingShells:
			SHTN A 0
			SHTN A 0 A_JumpIfInventory("AmmoShell",1,2)//if there are no more reserve shells, finish reload.
			Goto Pump2
			SHTN A 0
			SHTN A 0 A_GiveInventory ("Pumping", 1)
			SSHR A 0 A_TakeInventory("Reloading", 1)
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",8,"CheckIfFinishReload")
			SHTN A 0 A_Giveinventory("ShotgunAmmo",1)
			SHTN A 0 A_Takeinventory("AmmoShell",1)
			
		InsertShellAnimation:	
			SHTN A 0
			SSHR AAABC 1
			SSHR D 1 A_PlaySound("insertshell")
			SSHR EF 1 A_WeaponReady(WRF_NOBOB)
			SSHR A 0 A_JumpIfInventory("Reloading", 1, "Pump2")
			SHTN A 0 A_JumpIfInventory("Kicking",1,"DoKickReloading")
			SHTN A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",9,"FinishedInsertingShells")//If there are 8+1 shells, stop it immediately
			Goto InsertingShells
			
		CheckIfFinishReload:
			SSHR A 1
			SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, "FinishedInsertingShells")//If shotgun was empty, 
			//Play the insert shell animation again, and insert the 9th shell
			SHTN A 0 A_JumpIfInventory("AmmoShell",1,1)//if there are no more reserve shells, finish reload.
			Goto Pump2
			SHTN A 0 A_Giveinventory("ShotgunAmmo",1)
			SHTN A 0 A_Takeinventory("AmmoShell",1)
			Goto InsertShellAnimation
			
		FinishedInsertingShells:
			SHTN A 0 A_Takeinventory("Reloading",1)
			SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, "Pump2")
			SHTN FEDCBA 1 A_WeaponReady
			SHTN A 0 A_Takeinventory("Reloading",1)
			Goto Ready
			
		
		TurboReload:
			SHSS BC 0
		TurboBullets:	
			SHTN A 0
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",9,"FinishTurboReload")
			SHTN A 0 A_JumpIfInventory("AmmoShell",1,3)
			Goto FinishTurboReload
			TNT1 AAAA 0
			SHTN A 0 A_Giveinventory("ShotgunAmmo",1)
			SHTN A 0 A_Takeinventory("AmmoShell",1)
			Goto TurboBullets
		FinishTurboReload:
			SHTN A 1
			SHTN A 1 A_Refire
			Goto Ready3
			
		TurboReload2:
			SHSS BC 0
		TurboBullets2:	
			SHTN A 0
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",9,"FinishTurboReload")
			SHTN A 0 A_JumpIfInventory("AmmoShell",1,3)
			Goto FinishTurboReload2
			TNT1 AAAA 0
			SHTN A 0 A_Giveinventory("ShotgunAmmo",1)
			SHTN A 0 A_Takeinventory("AmmoShell",1)
			Goto TurboBullets2
		FinishTurboReload2:
			SHT8 A 1 A_Refire
			Goto Ready2

		PuristGun:
			TNT1 A 1
			SHTN A 0 A_GiveInventory("ClassicShotgun", 1)
			SHTN A 0 A_TakeInventory("Shot_Gun", 1)
			TNT1 A 10
			Goto Ready2
			
		Unload:
			SHTN A 1
			SHTN A 0 A_ZoomFactor(1.0)
			SHTN A 0 A_Takeinventory("Unloading",1)
			SHTN A 0 A_Takeinventory("ADSmode",1)
			SHTN A 0 A_Takeinventory("Zoomed",1)
			SHTN A 0 A_GiveInventory("ShotgunWasEmpty", 1)
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,3)
			Goto OkToFire
			TNT1 AAA 0
			SHTN A 0 A_Takeinventory("Zoomed",1)
			SHTN A 0 A_GiveInventory ("Pumping", 1)
			SHTN A 0 A_Takeinventory("Unloading",1)
			SHTN ABCDEF 1
			
		RemoveBullets:
			TNT1 AAAA 0
			SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,3)
			Goto FinishUnload
			TNT1 AAAAAA 0
			SHTN A 0 A_Takeinventory("ShotgunAmmo",1)
			SHTN A 0 A_Giveinventory("AmmoShell",1)

			SHTN G 1
			SHTN H 1 A_PlaySound("weapons/sgpump", 3)
			//SHTN A 0 A_SetPitch(+1 + pitch)
			SHTN IJ 1
			//SHTN A 0 A_SetPitch(-1 + pitch)
			SHTN KL 1
			SHTN KJIH 1
			SHTN A 0 A_Giveinventory("ShotgunWasEmpty",1)
			SHTN GF 1
			Goto RemoveBullets
		
		FInishUnload:
			SHTN EDCBA 1
			SHTN A 0 A_Takeinventory("Unloading",1)
			Goto OkToFire	
			
			
		DoKickReloading:
			NULL A 0 A_JumpIf (momZ > 0, "AirKick")
			NULL A 0 A_JumpIf (momZ < 0, "AirKick")
			SHTN A 0 A_PlaySound("KICK")
			SHTN A 0 SetPlayerProperty(0,1,0)
			KICK BCD 1
			RIFF A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
			KICK H 3
			KICK A 0 A_Takeinventory("Kicking",1)
			KICK I 1
			KICK GFEDCBA 1 
			RIBA A 0 A_Takeinventory("Kicking",1)
			SHTN A 0 SetPlayerProperty(0,0,0)
			Goto InsertingShells
			
		Steady:
			TNT1 A 1
			Goto Ready
			
			

		NoAmmo:
			RIFG A 0
			RIFG A 0 A_ZoomFactor(1.0)
			RIFG A 0 A_Takeinventory("Zoomed",1)
			RIFG A 0 A_Takeinventory("ADSmode",1)
			RIFG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
			TNT1 A 0 A_PlaySound("weapons/empty", 4)
			NoAmmo2:
			RIFG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
			RIFG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
			RIFG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
			RIFG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
			RIFG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			RIFG A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
			RIFG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			SHTN A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOPRIMARY)
			RIFG A 0 A_JumpIfInventory("Reloading",1,"Reload")
			RIFG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
			TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
			RIFG A 0 A_JumpIfInventory("AmmoShell",1,"Reload")
			RIFG A 0 A_JumpIfInventory("FiredPrimary",1,"NoAmmo2")
			Goto Ready3
			
			
		NoAmmo3:
			RIFG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
			RIFG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
			RIFG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
			RIFG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
			RIFG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			RIFG A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
			RIFG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			SHT8 A 4 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOPRIMARY)
			RIFG A 0 A_JumpIfInventory("Reloading",1,"Reload")
			RIFG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload2")
			TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo3")
			RIFG A 0 A_JumpIfInventory("AmmoShell",1,"Reload")
			RIFG A 0 A_JumpIfInventory("FiredPrimary",1,"NoAmmo3")
			Goto Ready3	
			
	}
}

ACTOR ShotgunAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 9
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 9
   Inventory.Icon "SHTCA0"
}



