ACTOR GE007AutomaticShotgun : Weapon
{
  Weapon.Kickback 100
  Scale 0.1
    Weapon.Ammotype1 "AutomaticShotgunClip"
    Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
	Weapon.AmmoGive2 5
	Weapon.AmmoType2 "GE007ShotgunAmmo"
	  +WEAPON.AMMO_OPTIONAL
	tag "Automatic Shotgun"
  Inventory.PickupMessage "Picked up a Automatic Shotgun."
  Obituary  "%k's Automatic Shotgun gut-shot forced %o to his knees."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
  States
  {
  Spawn:
    TKA1 B -1
    Loop
  Ready:
  TNT1 A 0 A_PlaySound ("GE007/Weapons/WeaponSFX1","Weapon")
    TK36 A 1 
    TK36 B 1
    TK36 C 1
    TK36 D 1
    TK36 EFGHIJKLMN 1
    TK36 O -1 A_WeaponReady
	goto ReloadCheck
	TK36 Q 1 A_WeaponReady
    Goto Ready+6
	
		ReloadCheck:
	 KLBG A 0 A_JumpIfInventory("AutomaticShotgunClip",5,2)
	 KLBG A 0 A_JumpIfInventory("GE007ShotgunAmmo",1,"ReloadStart")
	 KLBG A 0
	 goto Ready+15

  ReloadStart:
	 KLBR A 0 A_PlayWeaponSound("GE007/Weapons/Reload")
     TK36 MLKJIHGFEDCBA 1
	 TNT1 A 5
	 goto ReloadAmmo

  ReloadAmmo:
	 TNT1 A 0 A_TakeInventory("GE007ShotgunAmmo",1)
	 TNT1 A 0 A_GiveInventory("AutomaticShotgunClip",1)
	 TNT1 A 0 A_JumpIfInventory("AutomaticShotgunClip",5,"ReloadDone")
	 TNT1 A 0 A_JumpIfInventory("GE007ShotgunAmmo",1,"ReloadAmmo")
	 goto ReloadDone
	 
	 ReloadDone:
	 TNT1 A 5
	 TK36 ABCDEFGHIJKLMNO 1
	 goto Ready+15
  Deselect:
    TK36 MLKJIHGFEDCB 1
    TK36 A 1
    TK08 A 0 A_Lower
    wait
  Select: 
    TK08 A 0 A_Raise 
    Loop  
  Fire: 
  KLBG A 0 A_JumpIfNoAmmo("ReloadCheck")
 	TNT1 A 0 A_PlaySound ("GE007/Weapons/AutoShotgun","Weapon")
    TK36 P 1 BRIGHT A_FireBullets (6, 5, 5, 12, "BulletPuff",FBF_USEAMMO|FBF_NORANDOM)
	ASHG A 0 BRIGHT A_SpawnItemEx ("GE007ShellCasing", 30,cos(pitch)*12,sin(-pitch)*10+30, frandom(0.5,1.2),frandom(0.5,1.2),frandom(1.5,2.5))
	TK36 Q 1
    TK36 R 1
	TK36 ST 1
	TK36 U 1
	TK36 VXYZ 1
	TK37 ABCDEFGHIJK 1
    Goto Ready+15
		AltFire:
		TK04 A 0
		goto ReloadCheck
  }
}

ACTOR AutomaticShotgunClip : Ammo
{
Inventory.MaxAmount 5 // size of the clip
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 5 //MUST be the same as Inventory.MaxAmmount
+INVENTORY.IGNORESKILL
}

ACTOR GE007AutomaticShotgunPickup : Custominventory
{
   Scale 0.1
  Inventory.PickupMessage "Picked up a Automatic Shotgun."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
   States
   {
   Spawn:
	  TKA5 J -1
	  loop
   Pickup:
	  TNT1 A 0 A_GiveInventory("GE007AutomaticShotgun")
	  stop
   }
}
