actor NewShotgun : AliensWeapon replaces shotgun
{   
	weapon.selectionorder 2100
	Weapon.KickBack 8
	+weapon.noautofire
	+weapon.noalert
	+WEAPON.AMMO_OPTIONAL
	weapon.ammotype "ShotgunAmmo"
	weapon.ammotype2 "Shells"
	weapon.ammogive2 0
	weapon.ammogive 16
	weapon.ammouse 0
	weapon.slotnumber 3
	tag "M37A2 Pump Shotgun"
	inventory.pickupmessage "You got a custom M37A2 12 gauge semi-auto pump action shotgun!"
	states
	{
	Ready:
		SHOT A 0 A_JumpIfInventory("ReloadItem", 1, "Reload")
	    SHOT A 0 A_JumpIfInventory("KickItem", 1, "PreKick")
		TNT1 A 0 A_JumpIfInventory("TrackerToggle", 1, "PreTrack")
	    SHGN A 1 A_WeaponReady
		loop
	Select:
		SHOT A 0 A_Raise
		SHGN A 1 A_Raise
		loop
	Deselect:
		TNT1 A 0 A_StopSound(1)
		SHOT A 0 A_Lower
		SHGN A 1 A_Lower
		loop
	Fire:
		TNT1 A 0 A_JumpIfInventory("RadarActive", 1, "TrackerLower")
		SHGN A 0 A_JumpIfInventory("ShotgunAmmo",1,1)
		goto Click
		SHOT A 0 A_JumpIfInventory("Shots", 2, "ShellSpew2")
		SHOT A 0 A_GiveInventory("Shots", 1)
		SHOT A 0 A_PlayWeaponSound("weapons/shotgunfire")
		TNT1 A 0 A_Recoil(0.9)
		TNT1 A 0 A_TakeInventory("ShotgunAmmo", 1)
		TNT1 AAAA 0 A_FireCustomMissile("GunSpark",1.5+random(-5.5,5.5),0,0,6,0,1.5+random(-2.8,2.8))
		TNT1 AAAA 0 A_FireCustomMissile("GunSpark2",1.5+random(-5.5,5.5),0,0,6,0,1.5+random(-2.8,2.8))
		SHOT AAAAAAAAA 0 A_FireCustomMissile("ShotgunPellet", Frandom(-3,3), 0, 0, 0, 0, Frandom(-2,2))
		TNT1 A 0 A_FireBullets(0, 0, 1, 0, "InvisiPuff")
		SHOT A 0 A_AlertMonsters
		SHOF A 1 offset(0, 32) Radius_Quake(6,4,0,1,0)
		TNT1 A 0 A_SetPitch (pitch-1.2) 
		SHOF B 1 offset(0, 38) A_WeaponReady(WRF_NOBOB)
		TNT1 A 0 A_SetPitch (pitch-0.8)
		SHGN A 2 offset(0, 44) A_WeaponReady(WRF_NOBOB)
		SHGN A 3 offset(0, 38) A_WeaponReady(WRF_NOBOB)
		SHGN A 2 offset(0, 32) A_WeaponReady(WRF_NOBOB)
		SHOT A 0 A_JumpIfInventory("Shots", 1, "ShellSpew1")
	ShellSpew1:
		SHOT B 1 A_PlaySound("weapons/shotgunpump", CHAN_BODY)
		SHOT C 1
		SHOT D 1
		SHOT E 1
		SHOT F 2
		SHOT G 5
		TNT1 A 0 A_FireCustomMissile("ShellCasingSpawner", 3, 0, 0, 1)
		TNT1 A 0 A_TakeInventory("Shots", 2)
		goto FireEnd
	ShellSpew2:
	    SHOT B 1 A_PlaySound("weapons/shotgunpump", CHAN_BODY)
		SHOT C 1
		SHOT D 1
		SHOT E 1 
		SHOT F 2
		SHOT G 5
		TNT1 AA 0 A_FireCustomMissile("ShellCasingSpawner", 3, 0, 0, 1)
		TNT1 A 0 A_TakeInventory("Shots", 2)
		goto FireEnd
	FireEnd:
		SHOT F 2
		SHOT E 1
		SHOT D 1
		SHOT C 1
		SHOT B 1
		SHGN A 1
		goto Ready
	Click:
		SHGN A 1 A_PlaySound ("weapons/VP70click")
	Reload:
		SHGN A 2 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",16,"Ready")
		TNT1 A 0 A_JumpIfInventory("Shells",1,2)
		SHGN A 0
		Goto Ready
		TNT1 A 0 A_TakeInventory("ShotgunAmmo", 16)
		SHGN A 0 A_PlaySound ("weapons/shotgunreload1", CHAN_WEAPON)
		TNT1 A 0 A_FireCustomMissile("SpentMagB",frandom(-12,-6),0,0,-8,0,frandom(-3,3))
		SHGN A 2 offset(-8, 40)
		SHOT B 3 offset(-24, 56)
		SHOT C 4 offset(-40, 72)
		Loading:
		TNT1 A 0 A_TakeInventory("Shells", 1)
		TNT1 A 0 A_GiveInventory("ShotgunAmmo", 1)
		TNT1 A 0 A_JumpIfInventory("Shells",1,1)
		Goto EndReloading
		TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",16,1)
		Loop
    EndReloading:
		SHOT C 3 offset(-40, 72) A_PlaySound ("weapons/shotgunreload2", CHAN_WEAPON)
		SHOT B 2 offset(-24, 56)
		SHGN A 1 offset(-8, 40)
		Goto Ready
	Spawn:
		SHTP A -1
		loop
	PreKick:
	    SHGN A 1 offset(-8, 40)
		SHGN A 1 offset(-24, 56)
		SHGN A 1 offset(-40, 72)
		SHGN A 1 offset(-50, 88)
		SHGN A 1 offset(-66, 104)
		goto Kick
	PostKick:
		SHGN A 1 offset(-66, 104)
		SHGN A 1 offset(-50, 88)
		SHGN A 1 offset(-40, 72)
		SHGN A 1 offset(-24, 56)
		SHGN A 1 offset(-8, 40)
		goto ready
   PreTrack:
		SHGN A 1 offset(-8, 40)
		SHGN A 1 offset(-24, 56)
		SHGN A 1 offset(-40, 72)
		SHGN A 1 offset(-50, 88)
		SHGN A 1 offset(-66, 104)
		goto TrackRaise
   PostTrack:
		SHGN A 1 offset(-66, 104)
		SHGN A 1 offset(-50, 88)
		SHGN A 1 offset(-40, 72)
		SHGN A 1 offset(-24, 56)
		SHGN A 1 offset(-8, 40)
		goto ready
	}
}

actor Shots : Inventory
{
	inventory.amount 1
	inventory.maxamount 2
}

ACTOR ShotgunAmmo : Ammo
{
 Inventory.PickupMessage "You shouldn't see this!"
 Inventory.Amount 16
 Inventory.MaxAmount 16
 +IGNORESKILL
 Ammo.BackpackAmount 0
 Ammo.BackpackMaxAmount 16
}