actor normalChaingun : Weapon
{
  obituary "%o was mowed down by %k's chaingun."
  weapon.ammotype "ChaingunClip"
  weapon.ammouse 1
  weapon.ammogive2 999
  weapon.ammogive1 999
  weapon.ammotype2 "ChaingunAmmo"
  Weapon.SelectionOrder 600  
  states
  {
  Ready:
	M1GE A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload")  
	AK47 A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    CHGG A 1 A_WeaponReady
    loop
  Deselect: 
    CHGG A 0 A_Lower
    CHGG A 0 A_Lower
    CHGG A 1 A_Lower
    loop
  Select:
    CHGG A 0 A_Raise
    CHGG A 0 A_Raise
    CHGG A 1 A_Raise
    loop
  Fire:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG A 0 A_JumpIfNoAmmo("Reload")
    CHGG A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
    CHGG A 0 A_jumpifinventory("doubletap",1,"Fire_doubletap")
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG A 0 A_FireBullets (5.6, 0, 1, random(650,650), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG A 4 A_GunFlash
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG B 4 A_FireBullets (5.6, 0, 1, random(650,650), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG B 0 A_JumpIfNoAmmo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload")  
    CHGG B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    goto Ready
  Fire_deadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG A 0 A_JumpIfNoAmmo("Reload")
    CHGG A 0 A_jumpifinventory("doubletap",1,"Fire_doubletapdeadshot")
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG A 0 A_FireBullets (4.3, 0, 1, random(650,650), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG A 4 A_GunFlash
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG B 4 A_FireBullets (4.3, 0, 1, random(650,650), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG B 0 A_JumpIfNoAmmo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload")  
    CHGG B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    goto Ready
  Fire_doubletapdeadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG A 0 A_JumpIfNoAmmo("Reload")
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG A 0 A_FireBullets (4.3, 0, 1, random(650,650), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG A 2 A_GunFlash
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG B 2 A_FireBullets (4.3, 0, 1, random(650,650), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG B 0 A_JumpIfNoAmmo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload")  
    CHGG B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    goto Ready
  Fire_Doubletap:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG A 0 A_JumpIfNoAmmo("Reload")
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG A 0 A_FireBullets (5.6, 0, 1, random(650,650), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG A 2 A_GunFlash
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG B 2 A_FireBullets (5.6, 0, 1, random(650,650), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG B 0 A_JumpIfNoAmmo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload")  
    CHGG B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    goto Ready
  Reload:	
    PIRE A 0 A_takeinventory("IsReloading",1)
    CGRE A 0 A_jumpifinventory("SpeedCola",1,"Reload_speed")
	CGRE A 0 A_jumpifInventory("ChaingunClip",60,"Ready")
    CGRE A 0 A_JumpIfInventory("Chaingunammo", 1, 1)
	goto Ready+1
    CGRE ABCDEF 2
  Goto Reload2
  Reload2:
	CGRE F 0 A_GiveInventory("ChaingunClip",1)
	CGRE F 0 A_TakeInventory("Chaingunammo",1)
	CGRE F 0
	CGRE F 0 A_jumpifInventory("ChaingunClip",60,"ReloadDone")
	CGRE F 0 A_JumpIfInventory("Chaingunammo", 1, "Reload2")
    Goto Reloaddone
  ReloadDone:
	CGRE F 10 A_playsound("weapons/reload")
    CGRE FEDCBA 2
    Goto Ready
  Reload_speed:
	CGRE A 0 A_jumpifInventory("ChaingunClip",60,"Ready")
    CGRE A 0 A_JumpIfInventory("Chaingunammo", 1, 1)
	goto Ready+1
    CGRE ABCDEF 1
  Goto Reload2_speed
  Reload2_speed:
	CGRE F 0 A_GiveInventory("ChaingunClip",1)
	CGRE F 0 A_TakeInventory("Chaingunammo",1)
	CGRE F 0
	CGRE F 0 A_jumpifInventory("ChaingunClip",60,"ReloadDone_speed")
	CGRE F 0 A_JumpIfInventory("Chaingunammo", 1, "Reload2_speed")
    Goto Reloaddone_speed
  ReloadDone_speed:
	CGRE F 9 A_playsound("weapons/reload")
    CGRE FEDCBA 1
    Goto Ready
  ThrowGrenade:
     HNDG BCD 1
     HNDG E 1 A_PlaySound("weapons/grenadepin")
     HNDG FGHH 1
     HNDG I 1 A_PlaySound("weapons/grenadethr") 
     HNDG J 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
     HNDG J 0 A_PlaySound("weapons/grenadethr")
     HNDG JKLMNOPQ 1
     HNDG Q 0 A_TakeInventory("thrownade")
     Goto Ready
  Useknife:
     KNFG A 0 A_jumpifinventory("Machete",1,"UseMachete")
     KNFG ABC 2
	 KNFG C 0 A_CustomPunch (110,1,0,"KnifePuff")
	 KNFG DEF 2
	 KNFG F 0 A_TakeInventory("Kinfeammo")
	 goto ready
  UseMachete:
     MHT4 ABC 2
	 MHT4 C 0 A_CustomPunch (450,1,0,"Machetepuff")
	 MHT4 DEFG 2
	 MHT4 G 0 A_TakeInventory("Kinfeammo")
	 goto ready
  Flash:
    CHGF A 0 A_jumpifinventory("doubletap",1,"Flash_doubletap")
    CHGF A 4 bright A_Light1
    CHGF B 5 bright A_Light2
    CHGF A 0 bright A_Light0
    stop
  Flash_doubletap:
    CHGF A 2 bright A_Light1
    CHGF B 3 bright A_Light2
    CHGF A 0 bright A_Light0
	stop
  Spawn:
    MGUN A -1
    stop
  }
}

actor ChaingunClip : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 60
    ammo.backpackamount 0
    ammo.backpackmaxamount 60
    +IGNORESKILL
}


actor ChaingunAmmo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 60
    inventory.maxamount 600
    ammo.backpackamount 60
    ammo.backpackmaxamount 600
    +IGNORESKILL
    inventory.pickupmessage "Got Chaingun Bullets!!"  
    States
    {
    Spawn:
      CLIP A -1
      Stop
    }
}

actor PAPChaingunAmmo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 80
    inventory.maxamount 800
    ammo.backpackamount 80
    ammo.backpackmaxamount 800
    +IGNORESKILL
    inventory.pickupmessage "Got Chaingun Bullets!!"  
    States
    {
    Spawn:
      CLIP A -1
      Stop
    }
}

actor PAPChaingun : Weapon
{
  obituary "%o was mowed down by %k's chaingun."
  weapon.ammotype "PAPChaingunClip"
  weapon.ammouse 1
  weapon.ammogive2 999
  weapon.ammogive1 999
  weapon.ammotype2 "PAPChaingunAmmo"
  Weapon.SelectionOrder 1300  
  states
  {
  Ready:
	M1GE A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload")  
	AK47 A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    CHGG A 1 A_WeaponReady
    loop
  Dryfire:
    AK47 A 0 A_JumpIfInventory("IsReloading",1,"Reload")
    CHGG A 3
    Goto Reload
  Deselect: 
    CHGG A 0 A_Lower
    CHGG A 0 A_Lower
    CHGG A 1 A_Lower
    loop
  Select:
    CHGG A 0 A_Raise
    CHGG A 0 A_Raise
    CHGG A 1 A_Raise
    loop
  Useknife:
     KNFG A 0 A_jumpifinventory("Machete",1,"UseMachete")
     KNFG ABC 2
	 KNFG C 0 A_CustomPunch (110,1,0,"KnifePuff")
	 KNFG DEF 2
	 KNFG F 0 A_TakeInventory("Kinfeammo")
	 goto ready
  UseMachete:
     MHT4 ABC 2
	 MHT4 C 0 A_CustomPunch (450,1,0,"Machetepuff")
	 MHT4 DEFG 2
	 MHT4 G 0 A_TakeInventory("Kinfeammo")
	 goto ready
  Fire:
    CHGG A 0 A_JumpIfNoAmmo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
    CHGG A 0 A_jumpifinventory("doubletap",1,"Fire_doubletap")
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG A 0 A_FireBullets (5.6, 0, 1, random(1300,1300), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG A 4 A_GunFlash
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG B 4 A_FireBullets (5.6, 0, 1, random(1300,1300), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    goto Ready
  Fire_deadshot:
    CHGG A 0 A_JumpIfNoAmmo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG A 0 A_jumpifinventory("doubletap",1,"Fire_doubletapdeadshot")
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG A 0 A_FireBullets (2, 0, 1, random(1300,1300), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG A 4 A_GunFlash
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG B 4 A_FireBullets (2, 0, 1, random(1300,1300), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    goto Ready
  Fire_doubletapdeadshot:
    CHGG A 0 A_JumpIfNoAmmo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG A 0 A_FireBullets (2, 0, 1, random(1300,1300), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG A 2 A_GunFlash
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG B 2 A_FireBullets (2, 0, 1, random(1300,1300), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    goto Ready
  Fire_Doubletap:
    CHGG A 0 A_JumpIfNoAmmo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG A 0 A_FireBullets (5.6, 0, 1, random(1300,1300), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG A 2 A_GunFlash
	TNTT A 0 A_playsound("weapons/CGFire")
    CHGG B 2 A_FireBullets (5.6, 0, 1, random(1300,1300), "BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CHGG B 0 A_JumpIfNoAmmo("Reload") 
    goto Ready
  Reload:	
    PIRE A 0 A_takeinventory("IsReloading",1)
	CGRE A 0 A_jumpifinventory("SpeedCola",1,"Reload_speed")
	CGRE A 0 A_jumpifInventory("PAPChaingunClip",80,"Ready")
    CGRE A 0 A_JumpIfInventory("PAPChaingunammo", 1, 1)
	goto Ready+1
    CGRE ABCDEF 2
  Goto Reload2
  Reload2:
	CGRE F 0 A_GiveInventory("PAPChaingunClip",1)
	CGRE F 0 A_TakeInventory("PAPChaingunammo",1)
	CGRE F 0
	CGRE F 0 A_jumpifInventory("PAPChaingunClip",80,"ReloadDone")
	CGRE F 0 A_JumpIfInventory("PAPChaingunammo", 1, "Reload2")
    Goto Reloaddone
  ReloadDone:
	CGRE F 12 A_playsound("weapons/reload")
    CGRE FEDCBA 2
    Goto Ready
  Reload_speed:
	CGRE A 0 A_jumpifInventory("PAPChaingunClip",80,"Ready")
    CGRE A 0 A_JumpIfInventory("PAPChaingunammo", 1, 1)
	goto Ready+1
    CGRE ABCDEF 1
  Goto Reload2_speed
  Reload2_speed:
	CGRE F 0 A_GiveInventory("PAPChaingunClip",1)
	CGRE F 0 A_TakeInventory("PAPChaingunammo",1)
	CGRE F 0
	CGRE F 0 A_jumpifInventory("PAPChaingunClip",80,"ReloadDone_speed")
	CGRE F 0 A_JumpIfInventory("PAPChaingunammo", 1, "Reload2_speed")
    Goto Reloaddone_speed
  ReloadDone_speed:
	CGRE F 9 A_playsound("weapons/reload")
    CGRE FEDCBA 1
    Goto Ready
  ThrowGrenade:
     HNDG BCD 1
     HNDG E 1 A_PlaySound("weapons/grenadepin")
     HNDG FGHH 1
     HNDG I 1 A_PlaySound("weapons/grenadethr") 
     HNDG J 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
     HNDG J 0 A_PlaySound("weapons/grenadethr")
     HNDG JKLMNOPQ 1
     HNDG Q 0 A_TakeInventory("thrownade")
     Goto Ready
  Flash:
    CHGF A 0 A_jumpifinventory("doubletap",1,"Flash_doubletap")
    CHGF A 4 bright A_Light1
    CHGF B 5 bright A_Light2
    CHGF A 0 bright A_Light0
    stop
  Flash_doubletap:
    CHGF A 2 bright A_Light1
    CHGF B 3 bright A_Light2
    CHGF A 0 bright A_Light0
	stop
  Spawn:
    MGUN A -1
    stop
  }
}

actor PAPChaingunClip : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 80
    ammo.backpackamount 0
    ammo.backpackmaxamount 80
    +IGNORESKILL
}
