ACTOR GE007Shotgun : Weapon
{
  Weapon.Kickback 100
  Scale 0.1
      Weapon.Ammotype1 "GE007ShotgunClip"
    Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
	Weapon.AmmoGive2 5
	Weapon.AmmoType2 "GE007ShotgunAmmo"
	  +WEAPON.AMMO_OPTIONAL
	tag "Shotgun"
  Inventory.PickupMessage "Picked up a Shotgun."
  Obituary  "%o was spooked by %k's Shotgun."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
  States
  {
  Spawn:
    TKA1 T -1
    Loop
  Ready:
  TNT1 A 0 A_PlaySound ("GE007/Weapons/WeaponSFX1","Weapon")
    TK34 A 1 
    TK34 B 1
    TK34 C 1
    TK34 D 1
    TK34 EFGHIJKLM 1
    TK34 N -1 A_WeaponReady
	goto ReloadCheck
	TK32 N 1 A_WeaponReady
    Goto Ready+6
	
		ReloadCheck:
	 KLBG A 0 A_JumpIfInventory("GE007ShotgunClip",5,2)
	 KLBG A 0 A_JumpIfInventory("GE007ShotgunAmmo",1,"ReloadStart")
	 KLBG A 0
	 goto Ready+14

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

  ReloadAmmo:
	 TNT1 A 0 A_TakeInventory("GE007ShotgunAmmo",1)
	 TNT1 A 0 A_GiveInventory("GE007ShotgunClip",1)
	 TNT1 A 0 A_JumpIfInventory("GE007ShotgunClip",5,"ReloadDone")
	 TNT1 A 0 A_JumpIfInventory("GE007ShotgunAmmo",1,"ReloadAmmo")
	 goto ReloadDone
	 
	 ReloadDone:
	 TNT1 A 5
	 TK34 ABCDEFGHIJKLMN 1
	 goto Ready+14
  Deselect:
    TK34 MLKJIHGFEDCB 1
    TK34 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/Shotgun","Weapon")
    TK34 O 1 BRIGHT A_FireBullets (5, 4, 5, 11, "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))
	TK34 PQ 1
    TK34 R 1
	TK34 ST 1
	TK34 U 1
	TK34 VXYZ 1
	TK35 ABCDEFGHIJKL 1
    Goto Ready+14
		AltFire:
		TK04 A 0
		goto ReloadCheck
  }
}

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

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