ACTOR GE007PP7Silenced : Weapon
{
  Weapon.Kickback 100
  Scale 0.1
  
  Tag "PP7 Silenced"
        Weapon.Ammotype1 "PP7SilencedClip"
  Weapon.Ammotype2 "GE007PistolAmmo"
    Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.AmmoGive2 7
  +WEAPON.AMMO_OPTIONAL
   +WEAPON.NOALERT
  Inventory.PickupMessage "Picked up a PP7 Silenced."
  Obituary  "%k furiously silenced pistol'ed %o's head off."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
  States
  {
  Spawn:
    TKA1 R -1
    Loop
  Ready:
  TNT1 A 0 A_PlaySound ("GE007/Weapons/WeaponSFX1","Weapon")
    TK15 A 1 
    TK15 B 1
    TK15 C 1
    TK15 D 1
    TK15 EFGHIJKLMNO 1
    TK15 P -1 A_WeaponReady
	goto ReloadCheck
	TK15 P 1 A_WeaponReady
    Goto Ready+6
	
	  ReloadCheck:
	 KLBG A 0 A_JumpIfInventory("PP7SilencedClip",7,2)
	 KLBG A 0 A_JumpIfInventory("GE007PistolAmmo",1,"ReloadStart")
	 KLBG A 0
	 goto Ready+16

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

  ReloadAmmo:
	 TNT1 A 0 A_TakeInventory("GE007PistolAmmo",1)
	 TNT1 A 0 A_GiveInventory("PP7SilencedClip",1)
	 TNT1 A 0 A_JumpIfInventory("PP7SilencedClip",7,"ReloadDone")
	 TNT1 A 0 A_JumpIfInventory("GE007PistolAmmo",1,"ReloadAmmo")
	 goto ReloadDone
	 
	 ReloadDone:
	 TNT1 A 5
	 TK15 ABCDEFGHIJKLMNOP 1
	 goto Ready+16
	
  Deselect:
    TK15 ONMLKJIHGFEDCB 1
    TK15 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/PP7Slienced","Weapon")
    TK15 Q 1 BRIGHT A_FireBullets(1, 1, 1, 20, "BulletPuff",FBF_USEAMMO|FBF_NORANDOM)
	PP7G B 0 BRIGHT A_SpawnItemEx ("GE007BulletCasing", 30,cos(pitch)*12,sin(-pitch)*10+30, frandom(0.5,1.2),frandom(0.5,1.2),frandom(1.5,2.5))
    TK15 R 1 
	TK15 ST 1
	TK15 U 1
	TK15 VXYZ 1
	TK16 AB 1
	TK16 C 1 A_REFIRE
	TK16 DE 1
    Goto Ready+16
		AltFire:
		TK04 A 0
		goto ReloadCheck
  }
}

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

ACTOR GE007PP7SilencedPickup : Custominventory
{
   Scale 0.1
  Inventory.PickupMessage "Picked up a PP7 Silenced."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
   States
   {
   Spawn:
	  TKA4 Z -1
	  loop
   Pickup:
	  TNT1 A 0 A_GiveInventory("GE007PP7Silenced")
	  stop
   }
}
