Actor AK47 : Weapon
{
  obituary "%o was begded down by %k's AK47."
  Weapon.SelectionOrder 100  
  inventory.pickupmessage "You got the AK47!"
  weapon.ammotype "AK47Clip"
  weapon.ammouse 1
  weapon.ammogive1 999
  weapon.ammogive2 999
  weapon.ammotype2 "AK47Ammo"
  States
  {
  Ready:
    AK47 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
	AK47 A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    AK47 A 1 A_WeaponReady 
    loop
  Deselect: 
    AK47 A 0 A_Lower
    AK47 A 0 A_Lower
    AK47 A 1 A_Lower
    loop
  Select:
    AK47 A 0 A_Raise
    AK47 A 0 A_Raise
    AK47 A 1 A_Raise
    loop
  Fire:
    AK47 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
    AKRE A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
    AKRE A 0 A_jumpifinventory("Doubletap",1,"Fire_Doubletap")
	AK4F A 0 A_playsound("AK47/fire")
    AK4F A 3 bright A_FireBullets (4.2,2.5,-1,random(450,450),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	AK4F A 0 A_playsound("AK47/fire")
    AK4F B 3 bright A_FireBullets (4.2,2.5,-1,random(450,450),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    AK47 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_deadshot:
    AK47 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
    AKRE A 0 A_jumpifinventory("Doubletap",1,"Fire_Doubletapdeadshot")
	AK4F A 0 A_playsound("AK47/fire")
    AK4F A 3 bright A_FireBullets (2.1,1.3,-1,random(450,450),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	AK4F A 0 A_playsound("AK47/fire")
    AK4F B 3 bright A_FireBullets (2.1,1.3,-1,random(450,450),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    AK47 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_Doubletapdeadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
	AK4F A 0 A_playsound("AK47/fire")
    AK4F A 2 bright A_FireBullets (2.1,1.3,-1,random(450,450),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	AK4F A 0 A_playsound("AK47/fire")
    AK4F B 2 bright A_FireBullets (2.1,1.3,-1,random(450,450),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    AK47 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_Doubletap:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
	AK4F A 0 A_playsound("AK47/fire")
    AK4F A 2 bright A_FireBullets (4.2,2.5,-1,random(450,450),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	AK4F A 0 A_playsound("AK47/fire")
    AK4F B 2 bright A_FireBullets (4.2,2.5,-1,random(450,450),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    AK47 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Dryfire:
    AK47 A 3
    Goto Reload 
  Reload:
	AUG1 A 0 A_TakeInventory("IsReloading",1)
    AKRE A 0 A_jumpifinventory("Speedcola", 1,"Reload_speed")
    AKRE A 0 A_jumpifinventory("AK47clip", 30,"ready")
	AKRE A 0 A_jumpifinventory("AK47Ammo", 1, 1)
	goto ready+1
	AKRE G 0 A_playsound("AK47/clipout")
	AKRE ABCDEFG 2
	AKRE G 20
    Goto Reload2
  Reload2:
    AKRE A 0 A_Giveinventory("AK47clip",1)
	AKRE A 0 A_Takeinventory("AK47ammo",1)
    AKRE A 0 A_jumpifinventory("AK47clip",30,"reloaddone")
	AKRE A 0 A_jumpifinventory("AK47ammo",1,"reload2")
	goto reloaddone
  Reloaddone:
    AKRE G 0 A_playsound("AK47/clipin")
	AKRE G 15
	AKRE G 0 A_playsound("AK47/bolt")
	AKRE G 10
    AKRE GFEDCBA 2
	goto ready
  Reload_speed:
    AKRE A 0 A_jumpifinventory("AK47clip",30,"ready")
	AKRE A 0 A_jumpifinventory("AK47Ammo",1,1)
	goto ready+1
	AKRE G 0 A_playsound("AK47/clipout")
	AKRE ABCDEFG 1
	AKRE G 10
    Goto Reload2_speed
  Reload2_speed:
    AKRE A 0 A_Giveinventory("AK47clip",1)
	AKRE A 0 A_Takeinventory("AK47ammo",1)
    AKRE A 0 A_jumpifinventory("AK47clip",30,"reloaddone_speed")
	AKRE A 0 A_jumpifinventory("AK47ammo",1,"reload2_speed")
	goto reloaddone_speed
  Reloaddone_speed:
    AKRE G 0 A_playsound("AK47/clipin")
	AKRE G 7
	AKRE G 0 A_playsound("AK47/bolt")
	AKRE G 5
    AKRE GFEDCBA 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:
    TNT1 A 2 bright
    Stop
  Spawn:
    AK4I A -1
    Stop
  }
}

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

actor AK47Ammo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 30
    inventory.maxamount 300
    ammo.backpackamount 30
    ammo.backpackmaxamount 300
    +IGNORESKILL
    inventory.pickupmessage "Got AK47 rounds!"  
    States
    {
    Spawn:
      CLIP A -1
      Stop
    }
}

actor PAPAK47Ammo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 45
    inventory.maxamount 450
    ammo.backpackamount 45
    ammo.backpackmaxamount 450
    +IGNORESKILL
    inventory.pickupmessage "Got AK47 rounds!"  
    States
    {
    Spawn:
      CLIP A -1
      Stop
    }
}

Actor PAPAK47 : Weapon
{
  obituary "%o was begded down by %k's AK47."
  inventory.pickupmessage "You got the AK47!"
  weapon.ammotype "PAPAK47Clip"
  weapon.ammouse 1
  weapon.ammogive2 999
  weapon.ammogive1 999
  weapon.ammotype2 "PAPAK47Ammo"
  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")
    AK47 A 1 A_WeaponReady
    loop
  Deselect: 
    AK47 A 0 A_Lower
    AK47 A 0 A_Lower
    AK47 A 1 A_Lower
    loop
  Select:
    AK47 A 0 A_Raise
    AK47 A 0 A_Raise
    AK47 A 1 A_Raise
    loop
  Fire:
    AK47 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AKRE A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
    AKRE A 0 A_jumpifinventory("Doubletap",1,"Fire_Doubletap")
	AK4F A 0 A_playsound("AK47/fire")
    AK4F A 3 bright A_FireBullets (2.1,1.3,-1,random(1250,1250),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	AK4F A 0 A_playsound("AK47/fire")
    AK4F B 3 bright A_FireBullets (2.1,1.3,-1,random(1250,1250),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    AK47 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_deadshot:
    AK47 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AKRE A 0 A_jumpifinventory("Doubletap",1,"Fire_Doubletapdeadshot")
	AK4F A 0 A_playsound("AK47/fire")
    AK4F A 3 bright A_FireBullets (1,0.9,-1,random(1250,1250),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	AK4F A 0 A_playsound("AK47/fire")
    AK4F B 3 bright A_FireBullets (1,0.9,-1,random(1250,1250),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    AK47 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_Doubletap:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
	AK4F A 0 A_playsound("AK47/fire")
    AK4F A 2 bright A_FireBullets (1,0.9,-1,random(1250,1250),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	AK4F A 0 A_playsound("AK47/fire")
    AK4F B 2 bright A_FireBullets (1,0.9,-1,random(1250,1250),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    AK47 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_Doubletapdeadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
	AK4F A 0 A_playsound("AK47/fire")
    AK4F A 2 bright A_FireBullets (2.1,1.3,-1,random(1250,1250),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	AK4F A 0 A_playsound("AK47/fire")
    AK4F B 2 bright A_FireBullets (2.1,1.3,-1,random(1250,1250),"BulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    AK47 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 B 0 A_ReFire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AK47 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Reload:
	AUG1 A 0 A_TakeInventory("IsReloading",1)
    AKRE A 0 A_jumpifinventory("Speedcola", 1,"Reload_speed")
    AKRE A 0 A_jumpifinventory("PAPAK47clip", 45,"ready")
	AKRE A 0 A_jumpifinventory("PAPAK47Ammo", 1, 1)
	goto ready+1
	AKRE G 0 A_playsound("AK47/clipout")
	AKRE ABCDEFG 2
	AKRE G 20
    Goto Reload2
  Reload2:
    AKRE A 0 A_Giveinventory("PAPAK47clip",1)
	AKRE A 0 A_Takeinventory("PAPAK47ammo",1)
    AKRE A 0 A_jumpifinventory("PAPAK47clip",45,"reloaddone")
	AKRE A 0 A_jumpifinventory("PAPAK47ammo",1,"reload2")
	goto reloaddone
  Reloaddone:
    AKRE G 0 A_playsound("AK47/clipin")
	AKRE G 15
	AKRE G 0 A_playsound("AK47/bolt")
	AKRE G 10
    AKRE GFEDCBA 2
	goto ready
  Reload_speed:
    AKRE A 0 A_jumpifinventory("PAPAK47clip",45,"ready")
	AKRE A 0 A_jumpifinventory("PAPAK47Ammo",1,1)
	goto ready+1
	AKRE G 0 A_playsound("AK47/clipout")
	AKRE ABCDEFG 1
	AKRE G 10
    Goto Reload2_speed
  Reload2_speed:
    AKRE A 0 A_Giveinventory("PAPAK47clip",1)
	AKRE A 0 A_Takeinventory("PAPAK47ammo",1)
    AKRE A 0 A_jumpifinventory("PAPAK47clip",45,"reloaddone_speed")
	AKRE A 0 A_jumpifinventory("PAPAK47ammo",1,"reload2_speed")
	goto reloaddone_speed
  Reloaddone_speed:
    AKRE G 0 A_playsound("AK47/clipin")
	AKRE G 7
	AKRE G 0 A_playsound("AK47/bolt")
	AKRE G 5
    AKRE GFEDCBA 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:
    TNT1 A 2 bright
    Stop
  Spawn:
    AK4I A -1
    Stop
  }
}

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