ACTOR GE007Phantom : Weapon
{
  Weapon.Kickback 100
  Scale 0.1
   Weapon.Ammotype1 "PhantomClip"
    Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
	Weapon.AmmoGive2 50
	Weapon.AmmoType2 "GE007PistolAmmo"
	  +WEAPON.AMMO_OPTIONAL
  Inventory.PickupMessage "Picked up a Phantom."
  tag "Phantom"
  Obituary  "%k's Phantom burned out %o's brain."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
  States
  {
  Spawn:
    TKA1 P -1
    Loop
  Ready:
  TNT1 A 0 A_PlaySound ("GE007/Weapons/WeaponSFX1","Weapon")
    TK28 A 1 
    TK28 B 1
    TK28 C 1
    TK28 D 1
    TK28 EFGHIJKLMNOPQ 1
    TK28 R -1 A_WeaponReady
	goto ReloadCheck
	TK28 R 1 A_WeaponReady
    Goto Ready+6
	
		ReloadCheck:
	 KLBG A 0 A_JumpIfInventory("PhantomClip",50,2)
	 KLBG A 0 A_JumpIfInventory("GE007PistolAmmo",1,"ReloadStart")
	 KLBG A 0
	 goto Ready+17

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

  ReloadAmmo:
	 TNT1 A 0 A_TakeInventory("GE007PistolAmmo",1)
	 TNT1 A 0 A_GiveInventory("PhantomClip",1)
	 TNT1 A 0 A_JumpIfInventory("PhantomClip",50,"ReloadDone")
	 TNT1 A 0 A_JumpIfInventory("GE007PistolAmmo",1,"ReloadAmmo")
	 goto ReloadDone
	 
	 ReloadDone:
	 TNT1 A 5
	 TK28 ABCDEFGHIJKLMNOPQR 1
	 goto Ready+17
	
  Deselect:
    TK28 QPONMLKJIHGFEDCB 1
    TK28 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/KF7")
    TK28 S 1 BRIGHT A_FireBullets(5.1, 4, 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))
	TK28 TU 1
	TK28 U 1 A_REFIRE
	TK28 VXYZ 1
	TK29 ABCDEFGHIJKL 1
    Goto Ready+17
		AltFire:
		TK04 A 0
		goto ReloadCheck
  }
}

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

ACTOR GE007PhantomPickup : Custominventory
{
   Scale 0.1
  Inventory.PickupMessage "Picked up a Phantom."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
   States
   {
   Spawn:
	  TKA4 S -1
	  loop
   Pickup:
	  TNT1 A 0 A_GiveInventory("GE007Phantom")
	  stop
   }
}
