ACTOR GE007SilverPP7 : Weapon
{
  Weapon.Kickback 100
  Scale 0.1
     Weapon.Ammotype1 "SilverPP7Clip"
    Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
	Weapon.AmmoGive2 7
	Weapon.AmmoType2 "GE007MagnumAmmo"
	  +WEAPON.AMMO_OPTIONAL
	tag "Silver PP7"
  Inventory.PickupMessage "Picked up a Silver PP7."
  Obituary  "%o missed the fireworks but stuck around to enjoy %k's Silver PP7."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
  States
  {
  Spawn:
    TKA1 V -1
    Loop
  Ready:
  TNT1 A 0 A_PlaySound ("GE007/Weapons/WeaponSFX1","Weapon")
    TK42 A 1 
    TK42 B 1
    TK42 C 1
    TK42 D 1
    TK42 EFGHIJKLMN 1
    TK42 O -1 A_WeaponReady
	goto ReloadCheck
	TK42 O 1 A_WeaponReady
    Goto Ready+6
	
		ReloadCheck:
	 KLBG A 0 A_JumpIfInventory("SilverPP7Clip",7,2)
	 KLBG A 0 A_JumpIfInventory("GE007MagnumAmmo",1,"ReloadStart")
	 KLBG A 0
	 goto Ready+15

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

  ReloadAmmo:
	 TNT1 A 0 A_TakeInventory("GE007MagnumAmmo",1)
	 TNT1 A 0 A_GiveInventory("SilverPP7Clip",1)
	 TNT1 A 0 A_JumpIfInventory("SilverPP7Clip",7,"ReloadDone")
	 TNT1 A 0 A_JumpIfInventory("GE007MagnumAmmo",1,"ReloadAmmo")
	 goto ReloadDone
	 
	 ReloadDone:
	 TNT1 A 5
	 TK42 ABCDEFGHIJKLMN 1
	 goto Ready+15
  Deselect:
    TK42 NMLKJIHGFEDCB 1
    TK42 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/PP7","Weapon")
    TK42 P 1 BRIGHT A_FireCustomMissile("GE007SilverPP7Shot")
	PP7G B 0 BRIGHT A_SpawnItemEx ("BulletCasing", 30,cos(pitch)*12,sin(-pitch)*10+30, frandom(0.5,1.2),frandom(0.5,1.2),frandom(1.5,2.5))
	TK42 Q 1
    TK42 R 1
	TK42 ST 1
	TK42 U 1
	TK42 VXYZ 1
	TK43 ABCDE 1 A_REFIRE
    Goto Ready+15
		AltFire:
		TK04 A 0
		goto ReloadCheck
  }
}

Actor GE007SilverPP7Shot: Fastprojectile
{
	Height 1
	Radius 1
	Speed 5000
  Obituary  "%o missed the fireworks but stuck around to enjoy %k's Silver PP7."
	Damage 25
	Projectile
	+RIPPER
	+FORCEXYBILLBOARD
	+NOEXTREMEDEATH
	states
		{
		Spawn:
			TNT1 A 1
			loop
		Crash:
		Death:
 TNT1 A 0 A_SpawnItemEx("BulletPuff",0,0,0,0,0,0,0,128,0)
			stop
		}
}

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

ACTOR GE007SilverPP7Pickup : Custominventory
{
   Scale 0.1
  Inventory.PickupMessage "Picked up a Silver PP7."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
   States
   {
   Spawn:
	  TKA5 P -1
	  loop
   Pickup:
	  TNT1 A 0 A_GiveInventory("GE007SilverPP7")
	  stop
   }
}
