actor CamPistol : Weapon
{
//  Game Doom <- you don't have to worry about this!
  Weapon.SelectionOrder 1900 // Once you have a player class up and runing, you can abandon this!
  Weapon.SlotNumber 2 // This too!
  Weapon.AmmoUse 1 //Use this so the gun uses up ammo in the magazine rather than taking it in the fire state
  Weapon.AmmoGive1 12
  Weapon.AmmoGive2 36 //I put this in here for now, but you can remove it later and have the player start with whatever
  Weapon.AmmoType1 "CamPistolMagazine" //I renamed these two because I got confused lol
  Weapon.AmmoType2 "CamPistolAmmo"
  // I switched the ammo types around, only because thats how I do it, but if you want you can switch them back
  Obituary "%o shot by %k's corrosive pistol."
  Inventory.RestrictedTo "CameronClass"
  +WEAPON.WIMPY_WEAPON
  +AMMO_OPTIONAL
  +WEAPON.NOALERT //Made so the alt fire doesn't alert monsters
  Tag "Handgun"
  States
  {    
  Spawn:
    CPSW A -1
    Stop
  Ready:
    CAHG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
    loop
  Deselect:
    CAHG A 1 A_Lower
	TNT1 A 0 A_Lower
	TNT1 A 0 A_Lower
    loop
  Select:
    CAHG A 1 A_Raise
	TNT1 A 0 A_Raise
	TNT1 A 0 A_Raise
    loop
  Fire:    
	TNT1 A 0 A_JumpIfNoAmmo("Empty")    //This will jump to an empty state if there's no ammo left in the mag. The empty state will go to the reload from there if applicable
    CAHG A 1
    CAHG B 0 A_AlertMonsters //Alerts monsters since otherwise the weapon is silent!
    CAHG B 0 A_GunFlash
//    CAHG B 0 A_TakeInventory("CamPistolMagazine",1) Don't worry about this!
    CAHG B 2 A_FireBullets (5.6, 0, 1, 4, "CameronAcidicBulletPuff")
    CAHG B 0 A_PlaySound("weapons/campistol")
    CAHG C 2
    CAHG A 6
    CAHG A 0 A_ReFire
	// If you wanted to make the pistol semi-auto, instead of the A_ReFire above, you could do this!
	//CAHG A 6 A_WeaponReady(WRF_NOBOB)
    goto Ready
  Empty:
    CAHG A 0
	Goto Reload // Technically don't need this line but hey, whatever
  Reload:
	CAHG A 0 A_JumpIfInventory("CamPistolMagazine", 12, "Ready") //Have full ammo? Go to ready!
	CAHG A 0 A_JumpIfInventory("CamPistolAmmo", 1, "ReloadStart")
	CAHG A 1 A_WeaponReady(WRF_NOFIRE)
	Goto Ready
  ReloadStart:
    CAHG A 3 A_PlayWeaponSound("Weapons/wpnout")
    CAHG DEFG 3
	Goto ReloadWork
  ReloadWork: //Where the fun happens!
	CAHG G 0 A_TakeInventory("CamPistolAmmo",1) //Takes from your ammo pool
    CAHG G 0 A_GiveInventory("CamPistolMagazine",1) // Gives you a bullet in the mag
	CAHG G 0 A_JumpIfInventory("CamPistolMagazine",12,"ReloadFinish") //Is your mag full? Finish the animation!
    CAHG G 0 A_JumpifInventory("CamPistolAmmo",1,"ReloadWork") 
  ReloadFinish:
    CAHG H 3 A_PlayWeaponSound("Weapons/loadclip")
    CAHG I 5
    CAHG JKD 3
	Goto Ready
  Flash:
    CPSF A 2 bright A_Light1
    TNT1 A 2 bright A_Light1
    TNT1 A 3 bright A_Light2
    TNT1 A 0 bright A_Light0
    stop
  }
}

actor CamPistolMagazine : Ammo
{
	+IGNORESKILL // Make sure you add this so you don't get double ammo on lower difficulties
     Inventory.MaxAmount 12
}

actor CamPistolAmmo : Ammo
{
  Inventory.PickupMessage "$GOTCLIP" // "Picked up a clip."
  Inventory.Amount 12
  Inventory.MaxAmount 200
  Ammo.BackpackAmount 12
  Ammo.BackpackMaxAmount 400
  Inventory.Icon "CLIPA0"
  States
  {
  Spawn:
    CLIP A -1
    Stop
  }
}

Actor CameronAcidicBulletPuff : Bulletpuff
{
	+NOBLOCKMAP
	+NOGRAVITY
	+ALLOWPARTICLES
	+ALWAYSPUFF
	+PUFFGETSOWNER
	+POISONALWAYS
	+ADDITIVEPOISONDAMAGE
	+ADDITIVEPOISONDURATION
	DamageType "Corrosion"
	PoisonDamageType "Corrision"
	PoisonDamage 5,100,5
	Obituary "%o's flesh was corroded away by %k."
}

