actor "M16A4" : RGUWeapon
{
  obituary "%k gunned %o down with the M16A4."
  inventory.pickupmessage "M16A4"  
  //attacksound "u45/fire6"
  weapon.selectionorder 19
  weapon.ammotype "M16Clip"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "M16Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  states
  {
  Ready:
    M16A A 2 //A_PlayWeaponSound("m9/select")
    M16A BCDEFGHIJKLM 2 A_WeaponReady(WRF_NOPRIMARY)
    M16A M 0 A_JumpIfNoAmmo("Reload")
    M16A M 0 A_JumpIfInventory("Aiming",1,5)
    M16A M 0 A_JumpIfInventory("Reloading",1,"Reload")
    M16A M 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    M16A M 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16A M 1 A_WeaponReady
    goto Ready+13
    M16C E 0 A_JumpIfInventory("Reloading",1,"Reload")    
    M16C E 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    M16C E 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16C E 1 A_WeaponReady(WRF_NOBOB)
    goto Ready+19
  Deselect:
    M16A H 0 A_TakeInventory("Aiming",1)
    M16A H 0 ACS_ExecuteAlways(602,0,0,0,0)
    M16A H 0 A_TakeInventory("Reloading",1)
    M16A H 0 A_ZoomFactor(1.0)
    M16A H 0 A_Lower
    M16A M 1 A_Lower
    goto Deselect+2
  Select:
    M16A A 0 A_Raise
	M16A A 0 ACS_ExecuteAlways(602,0,0,0,0)
	TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    loop
  Fire:	
    M16A A 0 A_JumpIfInventory("Aiming",1,"FireAim")
    M16A M 1 A_JumpIfNoAmmo("ReloadStart")
    M16B A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Fire_SteadyAim")
    M16B A 0 A_PlayWeaponSound("m16/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair",17)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    M16B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,6,3)
    M16B A 1 BRIGHT A_FireBullets (7.0, 7.0, -1, 19, "RiflePuff", 1, 6000)
    M16B B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    M16B A 0 A_JumpIfNoAmmo("FireEmpty")
    M16B B 1 BRIGHT A_GunFlash
    M16B A 0 A_PlayWeaponSound("m16/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair",17)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    M16B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,6,3)
    M16B A 1 BRIGHT A_FireBullets (7.0, 7.0, -1, 19, "RiflePuff", 1, 6000)
    M16B B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    M16B A 0 A_JumpIfNoAmmo("FireEmpty")
    M16B B 1 BRIGHT A_GunFlash
    M16B A 0 A_PlayWeaponSound("m16/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair",17)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    M16B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,6,3)
    M16B A 1 BRIGHT A_FireBullets (7.0, 7.0, -1, 19, "RiflePuff", 1, 6000)
    M16B B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    M16B A 0 A_JumpIfNoAmmo("FireEmpty")
    M16B B 1 BRIGHT A_GunFlash
    M16B CDEF 1
    M16B A 0 A_JumpIfInventory("M16Ammo",1,2)
    M16B A 0 A_ReFire
    goto Ready+13
    M16B A 0 A_JumpIfNoAmmo("ReloadStart")
    M16B A 0 A_ReFire
    goto Ready+13
  FireEmpty:
    M16B B 1 BRIGHT A_GunFlash
    M16B CDEF 1
    M16A M 1 A_GiveInventory("M16Bolt",1)
    M16B A 0 A_JumpIfInventory("M16Ammo",1,2)
    M16B A 0 A_ReFire
    goto Ready+13
    M16B A 0 A_JumpIfNoAmmo("ReloadStart")
    M16B A 0 A_ReFire
    goto Ready+13
  Hold:
    M16A M 3 A_JumpIfInventory("Aiming",1,"HoldAim")
    M16A M 1 A_ReFire
    goto Ready+13
  HoldAim:
    M16C E 3
    M16C E 1 A_ReFire
    goto Ready+19
  FireAim:
    M16C E 1 A_JumpIfNoAmmo("ReloadStart")
    M16D A 0 A_PlayWeaponSound("m16/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair",17)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    M16D A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,3)
    M16D A 1 BRIGHT A_FireBullets (0.5, 0.5, -1, 19, "RiflePuff", 1, 6000)
    M16D B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    M16D A 0 A_JumpIfNoAmmo("FireAimEmpty")
    M16D B 1 BRIGHT A_GunFlash
    M16D A 0 A_PlayWeaponSound("m16/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair",17)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    M16D A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,3)
    M16D A 1 BRIGHT A_FireBullets (0.5, 0.5, -1, 19, "RiflePuff", 1, 6000)
    M16D B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    M16D A 0 A_JumpIfNoAmmo("FireAimEmpty")
    M16D B 1 BRIGHT A_GunFlash
    M16D A 0 A_PlayWeaponSound("m16/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair",17)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    M16D A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,3)
    M16D A 1 BRIGHT A_FireBullets (0.5, 0.5, -1, 19, "RiflePuff", 1, 6000)
    M16D B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    M16D A 0 A_JumpIfNoAmmo("FireAimEmpty")
    M16D B 1 BRIGHT A_GunFlash
    M16D CDD 1
    M16C E 1
    M16D A 0 A_JumpIfInventory("M16Ammo",1,2)
    M16D A 0 A_ReFire
    goto Ready+19
    M16B A 0 A_JumpIfNoAmmo("ReloadStart")
    M16B A 0 A_ReFire
    goto Ready+19
  FireAimEmpty:
    M16D B 1 BRIGHT A_GunFlash
    M16D CDD 1
    M16C E 1 A_GiveInventory("M16Bolt",1)
    M16C A 0 A_JumpIfInventory("M16Ammo",1,2)
    M16C A 0 A_ReFire
    goto Ready+19
    M16C A 0 A_JumpIfNoAmmo("ReloadStart")
    M16C A 0 A_ReFire
    goto Ready+19
  Reload: //AltFire:
    VECC A 0 A_JumpIfInventory("M16Ammo",1,"ReloadStart")
    VECC A 0 A_TakeInventory("Reloading",1)
    goto Ready+11
  ReloadStart:
  	TNT1 A 0 ACS_ExecuteAlways(652,0,0,0,0) // Shout "Reloading" 
    M16E A 0 A_JumpIfInventory("Aiming",1,"ReloadStartAim")
    M16E A 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
    M16E A 3 A_PlaySoundEx("m4a1/clipout","SoundSlot5")
    M16E BCDEFGH 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16E IJKLMNO 3 A_WeaponReady(WRF_NOFIRE)
    M16E P 3 A_PlaySoundEx("m4a1/clipin","SoundSlot5")
    M16E QR 3 A_TakeInventory("Reloading",1)
    goto ReloadAmmo
  ReloadAmmo:
    M16E Z 0 A_GiveInventory("M16Clip",1)
    M16E Z 0 A_TakeInventory("M16Ammo",1)
    M16E Z 0 A_JumpIfInventory("M16Clip",30,"ReloadEnd")
    M16E Z 0 A_JumpIfInventory("M16Ammo",1,"ReloadAmmo")
    goto ReloadEnd
  ReloadEnd:
    M16E S 0 A_JumpIfInventory("M16Bolt",1,"ReloadEndBolt") 
    M16E STU 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16E VWXY 3 A_WeaponReady(WRF_NOFIRE)
    M16E G 0 A_ReFire
    goto Ready+13
  ReloadEndBolt:
    M16F A 0 A_TakeInventory("M16Bolt",1)
    M16F ABC 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16F D 3 A_PlaySoundEx("m4a1/bolt","SoundSlot5")
    M16F EFGH 3 A_WeaponReady(WRF_NOFIRE)
    M16F IJKL 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16F V 0 A_ReFire
    goto Ready+13
  AltFire:
    M16C A 0 A_JumpIfInventory("Aiming",1,"AltFire2")
    M16C A 0 A_ZoomFactor(1.2)
    M16C ABCDE 1
    M16C G 0 A_GiveInventory("Aiming",1)
    M16C G 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto Ready+19
  AltFire2:
    M16C E 1 A_ZoomFactor(1.0)
    M16C EDCBA 1
    M16C A 0 A_TakeInventory("Aiming",1)
    M16C A 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto Ready+13
  ReloadStartAim:
    M16C E 1 A_ZoomFactor(1.0)
    M16C EDCBA 1
    M16C A 0 A_TakeInventory("Aiming",1)
    M16C 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 Y 15 
    WEAP A 0 A_SpawnItem("M16Pickup")
    stop
  Fire_SteadyAim:
    M16B A 0 A_PlayWeaponSound("m16/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair",17)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    M16B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,8,3)
    M16B A 1 BRIGHT A_FireBullets (4.62, 4.62, -1, 19, "RiflePuff", 1, 6000)
    M16B B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    M16B A 0 A_JumpIfNoAmmo("FireEmpty")
    M16B B 1 BRIGHT A_GunFlash
    M16B A 0 A_PlayWeaponSound("m16/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair",17)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    M16B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,8,3)
    M16B A 1 BRIGHT A_FireBullets (4.62, 4.62, -1, 19, "RiflePuff", 1, 6000)
    M16B B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    M16B A 0 A_JumpIfNoAmmo("FireEmpty")
    M16B B 1 BRIGHT A_GunFlash
    M16B A 0 A_PlayWeaponSound("m16/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair",17)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    M16B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,8,3)
    M16B A 1 BRIGHT A_FireBullets (4.62, 4.62, -1, 19, "RiflePuff", 1, 6000)
    M16B B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    M16B A 0 A_JumpIfNoAmmo("FireEmpty")
    M16B B 1 BRIGHT A_GunFlash
    M16B CDEF 1
    M16B A 0 A_JumpIfInventory("M16Ammo",1,2)
    M16B A 0 A_ReFire
    goto Ready+13
    M16B A 0 A_JumpIfNoAmmo("ReloadStart")
    M16B A 0 A_ReFire
    goto Ready+13
  ReloadStart_SOH:
    M16E A 2 A_PlaySoundEx("m4a1/clipout","SoundSlot5")
    M16E BCDEFGH 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16E IJKLMNO 2 A_WeaponReady(WRF_NOFIRE)
    M16E P 2 A_PlaySoundEx("m4a1/clipin","SoundSlot5")
    M16E QR 2 A_TakeInventory("Reloading",1)
    goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    M16E Z 0 A_GiveInventory("M16Clip",1)
    M16E Z 0 A_TakeInventory("M16Ammo",1)
    M16E Z 0 A_JumpIfInventory("M16Clip",30,"ReloadEnd_SOH")
    M16E Z 0 A_JumpIfInventory("M16Ammo",1,"ReloadAmmo_SOH")
    goto ReloadEnd_SOH
  ReloadEnd_SOH:
    M16E S 0 A_JumpIfInventory("M16Bolt",1,"ReloadEndBolt_SOH") 
    M16E STU 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16E VWXY 2 A_WeaponReady(WRF_NOFIRE)
    M16E G 0 A_ReFire
    goto Ready+13
  ReloadEndBolt_SOH:
    M16F A 0 A_TakeInventory("M16Bolt",1)
    M16F ABC 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16F D 2 A_PlaySoundEx("m4a1/bolt","SoundSlot5")
    M16F EFGH 2 A_WeaponReady(WRF_NOFIRE)
    M16F IJKL 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16F V 0 A_ReFire
    goto Ready+13
  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 M16Bolt : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}
actor M16Clip : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 30
    ammo.backpackamount 0
    ammo.backpackmaxamount 30
    +IGNORESKILL
}
actor "M16A4 Ex Mags" : "M16A4" 
{
  //attacksound "u45/fire6"
  weapon.selectionorder 19
  weapon.ammotype "M16Clip2"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "M16Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  states
  {
  Reload: //AltFire:
    VECC A 0 A_JumpIfInventory("M16Ammo",1,"ReloadStart")
    VECC A 0 A_TakeInventory("Reloading",1)
    goto Ready+11
  ReloadStart:
  	TNT1 A 0 ACS_ExecuteAlways(652,0,0,0,0) // Shout "Reloading" 
    M16E A 0 A_JumpIfInventory("Aiming",1,"ReloadStartAim")
    M16E A 0 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
    M16E A 3 A_PlaySoundEx("m4a1/clipout","SoundSlot5")
    M16E BCDEFGH 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16E IJKLMNO 3 A_WeaponReady(WRF_NOFIRE)
    M16E P 3 A_PlaySoundEx("m4a1/clipin","SoundSlot5")
    M16E QR 3 A_TakeInventory("Reloading",1)
    goto ReloadAmmo
  ReloadAmmo:
    M16E Z 0 A_GiveInventory("M16Clip2",1)
    M16E Z 0 A_TakeInventory("M16Ammo",1)
    M16E Z 0 A_JumpIfInventory("M16Clip2",45,"ReloadEnd")
    M16E Z 0 A_JumpIfInventory("M16Ammo",1,"ReloadAmmo")
    goto ReloadEnd
  ReloadEnd:
    M16E S 0 A_JumpIfInventory("M16Bolt",1,"ReloadEndBolt") 
    M16E STU 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16E VWXY 3 A_WeaponReady(WRF_NOFIRE)
    M16E G 0 A_ReFire
    goto Ready+13
  ReloadEndBolt:
    M16F A 0 A_TakeInventory("M16Bolt",1)
    M16F ABC 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16F D 3 A_PlaySoundEx("m4a1/bolt","SoundSlot5")
    M16F EFGH 3 A_WeaponReady(WRF_NOFIRE)
    M16F IJKL 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16F V 0 A_ReFire
    goto Ready+13
  ReloadStartAim:
    M16C E 1 A_ZoomFactor(1.0)
    M16C EDCBA 1
    M16C A 0 A_TakeInventory("Aiming",1)
    M16C A 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto ReloadStart+1
  ReloadStart_SOH:
    M16E A 2 A_PlaySoundEx("m4a1/clipout","SoundSlot5")
    M16E BCDEFGH 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16E IJKLMNO 2 A_WeaponReady(WRF_NOFIRE)
    M16E P 2 A_PlaySoundEx("m4a1/clipin","SoundSlot5")
    M16E QR 2 A_TakeInventory("Reloading",1)
    goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    M16E Z 0 A_GiveInventory("M16Clip2",1)
    M16E Z 0 A_TakeInventory("M16Ammo",1)
    M16E Z 0 A_JumpIfInventory("M16Clip2",45,"ReloadEnd_SOH")
    M16E Z 0 A_JumpIfInventory("M16Ammo",1,"ReloadAmmo_SOH")
    goto ReloadEnd_SOH
  ReloadEnd_SOH:
    M16E S 0 A_JumpIfInventory("M16Bolt",1,"ReloadEndBolt_SOH") 
    M16E STU 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16E VWXY 2 A_WeaponReady(WRF_NOFIRE)
    M16E G 0 A_ReFire
    goto Ready+13
  ReloadEndBolt_SOH:
    M16F A 0 A_TakeInventory("M16Bolt",1)
    M16F ABC 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16F D 2 A_PlaySoundEx("m4a1/bolt","SoundSlot5")
    M16F EFGH 2 A_WeaponReady(WRF_NOFIRE)
    M16F IJKL 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    M16F V 0 A_ReFire
    goto Ready+13
  }
}

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

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