actor "AA-12" : RGUWeapon
{
  obituary "%k filled %o with AA-12 pellets."
  inventory.pickupmessage "AA-12"  
  //attacksound "aa12/fire"
  weapon.selectionorder 8
  weapon.ammotype "AA12Clip"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "AA12Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  states
  {
  Ready:
    A12A A 2 //A_PlayWeaponSound("aa12/select")
    A12A BCDEFGHIJKLMN 2 A_WeaponReady(WRF_NOPRIMARY)
    A12A N 0 A_JumpIfNoAmmo("Reload")
    A12A N 0 A_JumpIfInventory("Aiming",1,5)
    A12A N 0 A_JumpIfInventory("Reloading",1,"Reload")
    A12A N 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    A12A N 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12A N 1 A_WeaponReady
    goto Ready+14
    A12C F 0 A_JumpIfInventory("Reloading",1,"Reload")    
    A12C F 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    A12C F 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12C F 1 A_WeaponReady(WRF_NOBOB)
    goto Ready+20
  Deselect:
    A12A L 0 A_TakeInventory("Aiming",1)
    A12A L 0 ACS_ExecuteAlways(602,0,0,0,0)
    SPSA L 0 A_TakeInventory("Reloading",1)    
    INTA L 0 A_ZoomFactor(1.0)
    A12A L 0 A_Lower
    A12A L 1 A_Lower
    goto Deselect+2
  Select:
    A12A A 0 A_Raise
	A12A A 0 ACS_ExecuteAlways(602,0,0,0,0)
	TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    loop
  Fire:		
    A12A N 0 A_JumpIfInventory("Aiming",1,"FireAim")
    A12A N 1 A_JumpIfNoAmmo("ReloadStart")
    A12B B 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Fire_SteadyAim")
    A12B A 0 A_PlayWeaponSound("aa12/fire")
    TNT1 A 0 A_GiveInventory("InCombatCrosshair",35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    A12B AA 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,8,3)
    A12B A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,8,3)
    A12B A 0 BRIGHT A_FireBullets (7.0, 7.0, 4, 5, "ShotgunPuff", 0, 200)
    A12B A 1 BRIGHT A_FireBullets (7.0, 7.0, 8, 6, "ShotgunPuff", 1, 450)
	A12B A 1 BRIGHT A_FireBullets (7.0, 7.0, 2, 2, "ShotgunPuff", 0, 650)
    A12B B 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12B A 0 A_JumpIfNoAmmo("FireEmpty")
    A12B B 1 BRIGHT A_GunFlash
    A12B B 0 A_GiveInventory("Firing",1)
    A12B C 1 
    A12B DE 1
    A12B A 0 A_TakeInventory("Firing",1)
    A12B A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12B A 0 A_ReFire
    goto Ready+14
    A12B A 0 A_JumpIfNoAmmo("ReloadStart")
    A12B A 0 A_ReFire
    goto Ready+14
  FireEmpty:
    A12B B 2 BRIGHT A_GunFlash
    A12B B 0 A_GiveInventory("AA12Bolt",1)
    A12B CDE 2 
    A12B A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12B A 0 A_ReFire
    goto Ready+14
    A12B A 0 A_JumpIfNoAmmo("ReloadStart")
    A12B A 0 A_ReFire
    goto Ready+14
  FireHold:
    A12B A 0 A_PlayWeaponSound("aa12/fire")
    TNT1 A 0 A_GiveInventory("InCombatCrosshair",35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    A12B AA 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,8,3)
    A12B A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,8,3)
    A12B A 0 BRIGHT A_FireBullets (7.0, 7.0, 4, 5, "ShotgunPuff", 0, 200)
    A12B A 1 BRIGHT A_FireBullets (7.0, 7.0, 8, 6, "ShotgunPuff", 1, 450)
	A12B A 1 BRIGHT A_FireBullets (7.0, 7.0, 2, 2, "ShotgunPuff", 0, 650)
    A12B B 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12B A 0 A_JumpIfNoAmmo("FireEmpty")
    A12B B 1 BRIGHT A_GunFlash
    A12B B 0 A_GiveInventory("Firing",1)
    A12B C 1 
    A12B DE 1 A_WeaponReady
    A12B A 0 A_TakeInventory("Firing",1)
    A12B A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12B A 0 A_ReFire
    goto Ready+14
    A12B A 0 A_JumpIfNoAmmo("ReloadStart")
    A12B A 0 A_ReFire
    goto Ready+14
  Hold:
    A12A N 0 A_JumpIfInventory("Aiming",1,"HoldAim")
    A12A N 0 A_JumpIfNoAmmo("ReloadStart")
    TNT1 A 0 A_GiveInventory("InCombatCrosshair",35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    A12B B 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Hold_SteadyAim")
    A12B A 0 A_PlayWeaponSound("aa12/fire")
    A12B AA 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,8,3)
    A12B A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,8,3)
    A12B A 0 BRIGHT A_FireBullets (7.0, 7.0, 4, 5, "ShotgunPuff", 0, 200)
    A12B A 1 BRIGHT A_FireBullets (7.0, 7.0, 8, 6, "ShotgunPuff", 1, 450)
	A12B A 1 BRIGHT A_FireBullets (7.0, 7.0, 2, 2, "ShotgunPuff", 0, 650)
    A12B B 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12B A 0 A_JumpIfNoAmmo("FireEmpty")
    A12B B 1 BRIGHT A_GunFlash
    A12B B 0 A_GiveInventory("Firing",1)
    A12B C 1 
    A12B DE 1
    A12B A 0 A_TakeInventory("Firing",1)
    A12B A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12B A 0 A_ReFire
    goto Ready+14
    A12B A 0 A_JumpIfNoAmmo("ReloadStart")
    A12B A 0 A_ReFire
    goto Ready+14
  HoldAim:
    A12C F 0 A_JumpIfNoAmmo("ReloadStart")
    A12C G 0 A_PlayWeaponSound("aa12/fire")
    A12C GG 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,0,3)
    A12C A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,0,3)
	A12C G 0 BRIGHT A_FireBullets (6.0, 6.0, 4, 5, "ShotgunPuff", 0, 200)
    A12C G 1 BRIGHT A_FireBullets (6.0, 6.0, 8, 6, "ShotgunPuff", 1, 450)
	A12C G 1 BRIGHT A_FireBullets (6.0, 6.0, 2, 2, "ShotgunPuff", 0, 650)
    A12C G 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12C G 0 A_JumpIfNoAmmo("FireAimEmpty")
    A12C H 1 BRIGHT A_GunFlash
    A12C H 0 A_GiveInventory("Firing",1)
    A12C I 1
    A12C JK 1
    A12C A 0 A_TakeInventory("Firing",1)
    A12C A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12C A 0 A_ReFire
    goto Ready+20
    A12C A 0 A_JumpIfNoAmmo("ReloadStart")
    A12C A 0 A_ReFire
    goto Ready+20
  FireAim:
    A12C F 1 A_JumpIfNoAmmo("ReloadStart")
    A12C G 0 A_PlayWeaponSound("aa12/fire")
    A12C GG 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,0,3)
    A12C A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,0,3)
	A12C G 0 BRIGHT A_FireBullets (6.0, 6.0, 4, 5, "ShotgunPuff", 0, 200)
    A12C G 1 BRIGHT A_FireBullets (6.0, 6.0, 8, 6, "ShotgunPuff", 1, 450)
	A12C G 1 BRIGHT A_FireBullets (6.0, 6.0, 2, 2, "ShotgunPuff", 0, 650)
    A12C G 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12C G 0 A_JumpIfNoAmmo("FireAimEmpty")
    A12C H 1 BRIGHT A_GunFlash
    A12C H 0 A_GiveInventory("Firing",1)
    A12C I 1
    A12C JK 1
    A12C A 0 A_TakeInventory("Firing",1)
    A12C A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12C A 0 A_ReFire
    goto Ready+20
    A12C A 0 A_JumpIfNoAmmo("ReloadStart")
    A12C A 0 A_ReFire
    goto Ready+20
  FireAimEmpty:
    A12C H 2 BRIGHT A_GunFlash
    A12C H 0 A_GiveInventory("AA12Bolt",1)
    A12C IJK 2 
    A12C A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12C A 0 A_ReFire
    goto Ready+20
    A12C A 0 A_JumpIfNoAmmo("ReloadStart")
    A12C A 0 A_ReFire
    goto Ready+20
  Reload: //AltFire:
    A12C A 0 A_JumpIfInventory("AA12Ammo",1,"ReloadStart")
    A12C A 0 A_TakeInventory("Reloading",1)
    goto Ready+17
  ReloadStart:
  	TNT1 A 0 ACS_ExecuteAlways(652,0,0,0,0) // Shout "Reloading" 
    A12D A 0 A_JumpIfInventory("Aiming",1,"ReloadStartAim")
    A12D A 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
    A12D ABCDEFGHI 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12D J 3 A_PlaySoundEx("aa12/clipout","SoundSlot5")
    A12D KLMNOPQ 3 A_WeaponReady(WRF_NOFIRE)
    A12D RSTUVWX 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12D Y 3 A_PlaySoundEx("aa12/clipin","SoundSlot5")
    A12D Z 3 A_TakeInventory("Reloading",1)
    goto ReloadAmmo
  ReloadAmmo:
    A12D Z 0 A_GiveInventory("AA12Clip",1)
    A12D Z 0 A_TakeInventory("AA12Ammo",1)
    A12D Z 0 A_JumpIfInventory("AA12Clip",8,"ReloadEnd")
    A12D Z 0 A_JumpIfInventory("AA12Ammo",1,"ReloadAmmo")
    goto ReloadEnd
  ReloadEnd:
    A12E A 0 A_JumpIfInventory("AA12Bolt",1,"ReloadEndBolt") 
    A12E ABC 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E DEF 3 A_WeaponReady(WRF_NOFIRE)
    A12E G 0 A_ReFire
    goto Ready+11 
  ReloadEndBolt:
    A12E Z 0 A_TakeInventory("AA12Bolt",1)
    A12E GHIJKL 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E M 3 A_PlaySoundEx("aa12/bolt","SoundSlot5")
    A12E NOPQRS 3 A_WeaponReady(WRF_NOFIRE)
    A12E TUV 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E V 0 A_ReFire
    goto Ready+11 
  AltFire:
    A12C A 0 A_JumpIfInventory("Aiming",1,"AltFire2")
    A12C A 0 A_ZoomFactor(1.2)
    A12C ABCDEF 1
    A12C F 0 A_GiveInventory("Aiming",1)
    A12C F 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto Ready+20
  AltFire2:
    A12C A 0 A_ZoomFactor(1.0)
    A12C FEDCBA 1
    A12C A 0 A_TakeInventory("Aiming",1)
    A12C A 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto Ready+14
  ReloadStartAim:
    A12C A 0 A_ZoomFactor(1.0)
    A12C FEDCBA 1
    A12C A 0 A_TakeInventory("Aiming",1)
    A12C A 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto ReloadStart+1
  Flash:
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    WEAP B 15
    TNT1 A 0 A_SpawnItem("AA12Pickup")
    stop
  ReloadStart_SOH:
    A12D ABCDEFGHI 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12D J 2 A_PlaySoundEx("aa12/clipout","SoundSlot5")
    A12D KLMNOPQ 2 A_WeaponReady(WRF_NOFIRE)
    A12D RSTUVWX 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12D Y 2 A_PlaySoundEx("aa12/clipin","SoundSlot5")
    A12D Z 2 A_TakeInventory("Reloading",1)
    goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    A12D Z 0 A_GiveInventory("AA12Clip",1)
    A12D Z 0 A_TakeInventory("AA12Ammo",1)
    A12D Z 0 A_JumpIfInventory("AA12Clip",8,"ReloadEnd_SOH")
    A12D Z 0 A_JumpIfInventory("AA12Ammo",1,"ReloadAmmo_SOH")
    goto ReloadEnd_SOH
  ReloadEnd_SOH:
    A12E A 0 A_JumpIfInventory("AA12Bolt",1,"ReloadEndBolt_SOH") 
    A12E ABC 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E DEF 2 A_WeaponReady(WRF_NOFIRE)
    A12E G 0 A_ReFire
    goto Ready+11 
  ReloadEndBolt_SOH:
    A12E Z 0 A_TakeInventory("AA12Bolt",1)
    A12E GHIJKL 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E M 2 A_PlaySoundEx("aa12/bolt","SoundSlot5")
    A12E NOPQRS 2 A_WeaponReady(WRF_NOFIRE)
    A12E TUV 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E V 0 A_ReFire
    goto Ready+11 
  Fire_SteadyAim:
  	TNT1 A 0 A_GiveInventory("InCombatCrosshair",35)
  	TNT1 F 0 A_GiveInventory("InCombat", 5)
    A12B A 0 A_PlayWeaponSound("aa12/fire")
    A12B AA 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,8,3)
    A12B A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,8,3)
	A12B A 0 BRIGHT A_FireBullets (6.0, 6.0, 4, 5, "ShotgunPuff", 0, 200)
    A12B A 1 BRIGHT A_FireBullets (6.0, 6.0, 8, 6, "ShotgunPuff", 1, 450)
	A12B A 1 BRIGHT A_FireBullets (6.0, 6.0, 2, 2, "ShotgunPuff", 0, 650)
    A12B B 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12B A 0 A_JumpIfNoAmmo("FireEmpty")
    A12B B 1 BRIGHT A_GunFlash
    A12B B 0 A_GiveInventory("Firing",1)
    A12B C 1 
    A12B DE 1
    A12B A 0 A_TakeInventory("Firing",1)
    A12B A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12B A 0 A_ReFire
    goto Ready+14
    A12B A 0 A_JumpIfNoAmmo("ReloadStart")
    A12B A 0 A_ReFire
    goto Ready+14
  Hold_SteadyAim:
  	TNT1 A 0 A_GiveInventory("InCombatCrosshair",35)
  	TNT1 F 0 A_GiveInventory("InCombat", 5)
    A12B A 0 A_PlayWeaponSound("aa12/fire")
    A12B AA 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,8,3)
    A12B A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,8,3)
    A12B A 0 BRIGHT A_FireBullets (6.0, 6.0, 4, 5, "ShotgunPuff", 0, 200)
    A12B A 1 BRIGHT A_FireBullets (6.0, 6.0, 8, 6, "ShotgunPuff", 1, 450)
	A12B A 1 BRIGHT A_FireBullets (6.0, 6.0, 2, 2, "ShotgunPuff", 0, 650)
    A12B B 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12B A 0 A_JumpIfNoAmmo("FireEmpty")
    A12B B 1 BRIGHT A_GunFlash
    A12B B 0 A_GiveInventory("Firing",1)
    A12B C 1 
    A12B DE 1
    A12B A 0 A_TakeInventory("Firing",1)
    A12B A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12B A 0 A_ReFire
    goto Ready+14
    A12B A 0 A_JumpIfNoAmmo("ReloadStart")
    A12B A 0 A_ReFire
    goto Ready+14
  FragGrenade:
    U45F A 0 A_ZoomFactor(1.0)
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45F A 0 ACS_ExecuteAlways(602,0,0,0,0)
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"FragGrenade_SOH")
    GRNA A 2 A_PlaySound("grenade/pinpull")
    GRNA BCDEFGH 2
    TNT1 A 15 
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("FragGrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("FragGrenade",0,0,0,16)
    GRNA MN 2 
    goto Ready+1
  FragGrenade_SOH:
    GRNA A 1 A_PlaySound("grenade/pinpull")
    GRNA BCDEFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("FragGrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("FragGrenade",0,0,0,16)
    GRNA MN 1 
    goto Ready+1
  KnifeAttack:
    U45F A 0 A_ZoomFactor(1.0)
    U45A L 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45F A 0 ACS_ExecuteAlways(602,0,0,0,0)
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"KnifeAttack_SOH")
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_Commando")
    KNFA A 0 ACS_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",96)
    KNFA FGHIJKL 1 
    TNT1 A 20
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  KnifeAttack_Commando:
    KNFA A 0 ACS_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",160)
    KNFA FGHIJKL 1 
    TNT1 A 20
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  KnifeAttack_SOH:
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_SOH_Commando")
    KNFA A 0 ACS_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",96)
    KNFA FGHIJKL 1 
    TNT1 A 10
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  KnifeAttack_SOH_Commando:
    KNFA A 0 ACS_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",160)
    KNFA FGHIJKL 1 
    TNT1 A 10
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  }
}

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

actor AA12Bolt : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}
actor "AA-12 Ex Mags" : "AA-12"
{
  obituary "%k filled %o with AA-12 pellets."
  inventory.pickupmessage "AA-12"  
  //attacksound "aa12/fire"
  weapon.selectionorder 8
  weapon.ammotype "AA12Clip2"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "AA12Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  states
  {
  Reload: //AltFire:
    A12C A 0 A_JumpIfInventory("AA12Ammo",1,"ReloadStart")
    A12C A 0 A_TakeInventory("Reloading",1)
    goto Ready+17
  ReloadStart:
  	TNT1 A 0 ACS_ExecuteAlways(652,0,0,0,0) // Shout "Reloading" 
    A12D A 0 A_JumpIfInventory("Aiming",1,"ReloadStartAim")
    A12D A 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
    A12D ABCDEFGHI 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12D J 3 A_PlaySoundEx("aa12/clipout","SoundSlot5")
    A12D KLMNOPQ 3 A_WeaponReady(WRF_NOFIRE)
    A12D RSTUVWX 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12D Y 3 A_PlaySoundEx("aa12/clipin","SoundSlot5")
    A12D Z 3 A_TakeInventory("Reloading",1)
    goto ReloadAmmo
  ReloadAmmo:
    A12D Z 0 A_GiveInventory("AA12Clip2",1)
    A12D Z 0 A_TakeInventory("AA12Ammo",1)
    A12D Z 0 A_JumpIfInventory("AA12Clip2",16,"ReloadEnd")
    A12D Z 0 A_JumpIfInventory("AA12Ammo",1,"ReloadAmmo")
    goto ReloadEnd
  ReloadEnd:
    A12E A 0 A_JumpIfInventory("AA12Bolt",1,"ReloadEndBolt") 
    A12E ABC 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E DEF 3 A_WeaponReady(WRF_NOFIRE)
    A12E G 0 A_ReFire
    goto Ready+11 
  ReloadEndBolt:
    A12E Z 0 A_TakeInventory("AA12Bolt",1)
    A12E GHIJKL 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E M 3 A_PlaySoundEx("aa12/bolt","SoundSlot5")
    A12E NOPQRS 3 A_WeaponReady(WRF_NOFIRE)
    A12E TUV 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E V 0 A_ReFire
    goto Ready+11 
  ReloadStartAim:
    A12C A 0 A_ZoomFactor(1.0)
    A12C FEDCBA 1
    A12C A 0 A_TakeInventory("Aiming",1)
    A12C A 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto ReloadStart+1
  ReloadStart_SOH:
    A12D ABCDEFGHI 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12D J 2 A_PlaySoundEx("aa12/clipout","SoundSlot5")
    A12D KLMNOPQ 2 A_WeaponReady(WRF_NOFIRE)
    A12D RSTUVWX 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12D Y 2 A_PlaySoundEx("aa12/clipin","SoundSlot5")
    A12D Z 2 A_TakeInventory("Reloading",1)
    goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    A12D Z 0 A_GiveInventory("AA12Clip2",1)
    A12D Z 0 A_TakeInventory("AA12Ammo",1)
    A12D Z 0 A_JumpIfInventory("AA12Clip2",16,"ReloadEnd_SOH")
    A12D Z 0 A_JumpIfInventory("AA12Ammo",1,"ReloadAmmo_SOH")
    goto ReloadEnd_SOH
  ReloadEnd_SOH:
    A12E A 0 A_JumpIfInventory("AA12Bolt",1,"ReloadEndBolt_SOH") 
    A12E ABC 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E DEF 2 A_WeaponReady(WRF_NOFIRE)
    A12E G 0 A_ReFire
    goto Ready+11 
  ReloadEndBolt_SOH:
    A12E Z 0 A_TakeInventory("AA12Bolt",1)
    A12E GHIJKL 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E M 2 A_PlaySoundEx("aa12/bolt","SoundSlot5")
    A12E NOPQRS 2 A_WeaponReady(WRF_NOFIRE)
    A12E TUV 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    A12E V 0 A_ReFire
    goto Ready+11 
  }
}

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

actor AA12ExMags : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}
actor "AA-12 Grip" : "AA-12"
{/*
  obituary "%k filled %o with AA-12 pellets."
  inventory.pickupmessage "AA-12"  
  //attacksound "aa12/fire"
  weapon.selectionorder 8
  weapon.ammotype "AA12Clip"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "AA12Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  states
  {
  Fire:
    A12A N 0 A_JumpIfInventory("Aiming",1,"FireAim")
    A12A N 1 A_JumpIfNoAmmo("ReloadStart")
    A12B B 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Fire_SteadyAim")
    A12B A 0 A_PlayWeaponSound("aa12/fire")
    A12B AA 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,8,3)
    A12B A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,8,3)
    A12B A 0 BRIGHT A_FireBullets (5.0, 5.0, 4, 4, "ShotgunPuff", 0, 160)
    A12B A 2 BRIGHT A_FireBullets (5.0, 5.0, 6, 5, "ShotgunPuff", 1, 1500)
    A12B B 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12B A 0 A_JumpIfNoAmmo("FireEmpty")
    A12B B 1 BRIGHT A_GunFlash
    A12B B 0 A_GiveInventory("Firing",1)
    A12B C 1 
    A12B DE 1
    A12B A 0 A_TakeInventory("Firing",1)
    A12B A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12B A 0 A_ReFire
    goto Ready+14
    A12B A 0 A_JumpIfNoAmmo("ReloadStart")
    A12B A 0 A_ReFire
    goto Ready+14
  Hold:
    A12A N 0 A_JumpIfInventory("Aiming",1,"HoldAim")
    A12A N 0 A_JumpIfNoAmmo("ReloadStart")
    A12B B 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Hold_SteadyAim")
    A12B A 0 A_PlayWeaponSound("aa12/fire")
    A12B AA 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,8,3)
    A12B A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,8,3)
    A12B A 0 BRIGHT A_FireBullets (6.0, 6.0, 4, 4, "ShotgunPuff", 0, 160)
    A12B A 2 BRIGHT A_FireBullets (6.0, 6.0, 6, 5, "ShotgunPuff", 1, 1500)
    A12B B 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12B A 0 A_JumpIfNoAmmo("FireEmpty")
    A12B B 1 BRIGHT A_GunFlash
    A12B B 0 A_GiveInventory("Firing",1)
    A12B C 1 
    A12B DE 1
    A12B A 0 A_TakeInventory("Firing",1)
    A12B A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12B A 0 A_ReFire
    goto Ready+14
    A12B A 0 A_JumpIfNoAmmo("ReloadStart")
    A12B A 0 A_ReFire
    goto Ready+14
  HoldAim:
    A12C F 0 A_JumpIfNoAmmo("ReloadStart")
    A12C G 0 A_PlayWeaponSound("aa12/fire")
    A12C GG 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,0,3)
    A12C A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,0,3)
    A12C G 0 BRIGHT A_FireBullets (5.0, 5.0, 4, 4, "ShotgunPuff", 0, 160)
    A12C G 2 BRIGHT A_FireBullets (5.0, 5.0, 6, 5, "ShotgunPuff", 1, 1500)
    A12C G 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12C G 0 A_JumpIfNoAmmo("FireAimEmpty")
    A12C H 1 BRIGHT A_GunFlash
    A12C H 0 A_GiveInventory("Firing",1)
    A12C I 1
    A12C JK 1
    A12C A 0 A_TakeInventory("Firing",1)
    A12C A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12C A 0 A_ReFire
    goto Ready+20
    A12C A 0 A_JumpIfNoAmmo("ReloadStart")
    A12C A 0 A_ReFire
    goto Ready+20
  FireAim:
    A12C F 1 A_JumpIfNoAmmo("ReloadStart")
    A12C G 0 A_PlayWeaponSound("aa12/fire")
    A12C GG 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,0,3)
    A12C A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,0,3)
    A12C G 0 BRIGHT A_FireBullets (4.0, 4.0, 4, 4, "ShotgunPuff", 0, 160)
    A12C G 2 BRIGHT A_FireBullets (4.0, 4.0, 6, 5, "ShotgunPuff", 1, 1500)
    A12C G 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12C G 0 A_JumpIfNoAmmo("FireAimEmpty")
    A12C H 1 BRIGHT A_GunFlash
    A12C H 0 A_GiveInventory("Firing",1)
    A12C I 1
    A12C JK 1
    A12C A 0 A_TakeInventory("Firing",1)
    A12C A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12C A 0 A_ReFire
    goto Ready+20
    A12C A 0 A_JumpIfNoAmmo("ReloadStart")
    A12C A 0 A_ReFire
    goto Ready+20
  Fire_SteadyAim:
    A12B A 0 A_PlayWeaponSound("aa12/fire")
    A12B AA 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,8,3)
    A12B A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,8,3)
    A12B A 0 BRIGHT A_FireBullets (4.0, 4.0, 4, 4, "ShotgunPuff", 0, 160)
    A12B A 2 BRIGHT A_FireBullets (4.0, 4.0, 6, 5, "ShotgunPuff", 1, 1500)
    A12B B 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12B A 0 A_JumpIfNoAmmo("FireEmpty")
    A12B B 1 BRIGHT A_GunFlash
    A12B B 0 A_GiveInventory("Firing",1)
    A12B C 1 
    A12B DE 1
    A12B A 0 A_TakeInventory("Firing",1)
    A12B A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12B A 0 A_ReFire
    goto Ready+14
    A12B A 0 A_JumpIfNoAmmo("ReloadStart")
    A12B A 0 A_ReFire
    goto Ready+14
  Hold_SteadyAim:
    A12B A 0 A_PlayWeaponSound("aa12/fire")
    A12B AA 0 A_FireCustomMissile("WeaponSmokePuffShotgun",0,0,8,3)
    A12B A 0 A_FireCustomMissile("WeaponSmokePuff_BigMuzzle",0,0,8,3)
    A12B A 0 BRIGHT A_FireBullets (5.0, 5.0, 4, 4, "ShotgunPuff", 0, 160)
    A12B A 2 BRIGHT A_FireBullets (5.0, 5.0, 6, 5, "ShotgunPuff", 1, 1500)
    A12B B 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    A12B A 0 A_JumpIfNoAmmo("FireEmpty")
    A12B B 1 BRIGHT A_GunFlash
    A12B B 0 A_GiveInventory("Firing",1)
    A12B C 1 
    A12B DE 1
    A12B A 0 A_TakeInventory("Firing",1)
    A12B A 0 A_JumpIfInventory("AA12Ammo",1,2)
    A12B A 0 A_ReFire
    goto Ready+14
    A12B A 0 A_JumpIfNoAmmo("ReloadStart")
    A12B A 0 A_ReFire
    goto Ready+14
  }*/
}

actor AA12Grip : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}
actor AA12Pickup : CustomInventory
{
  inventory.pickupmessage "AA-12"  
  inventory.pickupsound "misc/w_pkup"
  +INVENTORY.AUTOACTIVATE
  inventory.respawntics 35
  scale 0.15
  States
  {
  Spawn:
    WEAP B -1
    stop
  Pickup:
    JDGP A 0
    JDGP A 0 A_JumpIfInventory("AA-12",1,"FailPickup") // If the player already has this weapon, they get more ammo for it
    JDGP A 0 A_JumpIfInventory("AA-12 Ex Mags",1,"FailPickup")
    JDGP A 0 A_JumpIfInventory("AA-12 Grip",1,"FailPickup")
    JDGP A 0 A_JumpIfInventory("MaxWeaponsFilled",0,"FailPickup2")
    BKPK A 0 ACS_ExecuteWithResult(618,8,0,0)
    stop  
  AmmoPickup:
    JDGP A 0
    JDGP A 0 A_JumpIfInventory("AA12Ammo",0,"FailPickup")
    JDGP A 0 A_GiveInventory("AA12Ammo",8)
    stop
  FailPickup:
    WEAP B 1
    fail
  FailPickup2:
    WEAP B 1 
    BKPK A 0 ACS_ExecuteAlways(620,0,1,0,0)
    fail
  }
}
