ACTOR "Legendary AK-47 " : "Legendary AK-47" Replaces "Legendary AK-47"
{
Weapon.PreferredSkin "LegendaryAK47-Marine"
Weapon.AmmoType "LAK47Magazine"
Weapon.AmmoType2 "LegendaryLMGBulletMag"
Weapon.SelectionOrder 380
Weapon.KickBack 120
Weapon.AmmoGive 31
Weapon.AmmoGive2 20
Weapon.AmmoUse 1
Scale 0.95
Inventory.PickupSound "weapons/legAK47Reload3"
Obituary "%o was perforated by %k's Legendary AK-47."
Inventory.PickupMessage "Legendary AK-47"
Decal LegBulletChip
+WEAPON.AMMO_OPTIONAL
+WEAPON.NOALERT
-INVENTORY.UNDROPPABLE
States 
{
  Deselect:
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	TNT1 A 0 A_Lower
	A47G A 1 A_Lower
	Goto Deselect+1
  Select:
	TNT1 A 0 A_Raise
	Wait
  Ready:
	TNT1 A 0 A_PlayWeaponSound("weapons/legAK47Select")
	A47S ABCDEF 1
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	A47G A 1 A_WeaponReady
	Goto Ready+7
  Fire:
	TNT1 A 0 A_JumpIfNoAmmo("Empty")	
	TNT1 A 0 A_PlaySound("weapons/legAK47Fire")
	TNT1 A 0 A_AlertMonsters	
	TNT1 A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(1,2,0,1,0)
	TNT1 A 0 A_SpawnItemEx("LegRifleCasing",30,3,25,Random(2,4),Random(3,6),Random(3,6),0)
	TNT1 A 0 A_Light1
	TNT1 A 0 A_ZoomFactor(0.99)
	A47F A 1 Bright A_FireBullets(4.0,2.4,1,Random(48,62),"LegendaryASGBulletPuff")
	A47F B 1 Bright
	TNT1 A 0 A_Light0
	TNT1 A 0 A_Recoil(0.1)
	A47F CD 1
	TNT1 A 0 A_ZoomFactor(1.0)
	TNT1 A 0 A_JumpIfInventory("LAK47Magazine",1,1)
	Goto Ready+7
	TNT1 A 0 A_PlaySound("weapons/legAK47Fire")
	TNT1 A 0 A_AlertMonsters	
	TNT1 A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(1,2,0,1,0)
	TNT1 A 0 A_SpawnItemEx("LegRifleCasing",30,3,25,Random(2,4),Random(3,6),Random(3,6),0)
	TNT1 A 0 A_Light2
	A47F A 1 Bright A_FireBullets(4.0,2.4,1,Random(30,50),"LegendaryASGBulletPuff")
	A47F B 1 Bright
	TNT1 A 0 A_Light0
	TNT1 A 0 A_Recoil(0.1)
	A47F CD 1
	TNT1 A 0 A_ReFire
	Goto Ready+7
  Flash:
	TNT1 A 0
	Goto LightDone
  Empty:
	A47G A 10 A_PlayWeaponSound("weapons/click")
  AltFire:
  	TNT1 A 0 A_JumpIfInventory("LAK47Magazine",31,2)
	TNT1 A 0 A_JumpIfInventory("LegendaryLMGBulletMag",1,2)
	TNT1 A 0
	Goto Ready+7
	TNT1 A 0 A_JumpIfInventory("LAK47Magazine",1,"MaxReload")
	A47R A 1 A_PlayWeaponSound("weapons/legAK47Reload1")
 	A47R BCD 1
	A47R E 1 A_FireCustomMissile("LegAK47EmptyMagSpawner", 0, 0, 0, 1)
	A47R F 1
	A47R G 8
	A47R HIJK 1
	A47R L 8 A_PlayWeaponSound("weapons/legAK47Reload2")
	A47R MN 2 
	A47R OP 1
	A47R T 1 A_PlayWeaponSound("weapons/legAK47Reload3")
	A47R U 3
	A47R V 4 
	A47R W 3
	A47R XY 2
	TNT1 A 0 A_JumpIfInventory("LegendaryLMGBulletMag",1,"Reload")
  Reload:
	TNT1 A 0 A_TakeInventory("LegendaryLMGBulletMag",1)
	TNT1 A 0 A_GiveInventory("LAK47Magazine",1)
	TNT1 A 0 A_JumpIfInventory("LAK47Magazine",30,2)
	TNT1 A 0 A_JumpIfInventory("LegendaryLMGBulletMag",1,"Reload")
	TNT1 A 0
	Goto Ready+7
  MaxReload:
	A47R A 1 A_PlayWeaponSound("weapons/arreload")
 	A47R BCD 1
	A47R E 1 A_FireCustomMissile("LegAK47EmptyMagSpawner", 0, 0, 0, 1)
	A47R F 1
	A47R G 8
	A47R HIJK 1
	TNT1 A 0 A_JumpIfInventory("LegendaryLMGBulletMag",1,"Reload2")
  Reload2:
	TNT1 A 0 A_TakeInventory("LegendaryLMGBulletMag",1)
	TNT1 A 0 A_GiveInventory("LAK47Magazine",1)
	TNT1 A 0 A_JumpIfInventory("LAK47Magazine",31,"Full")
	TNT1 A 0 A_JumpIfInventory("LegendaryLMGBulletMag",1,"Reload2")
  Full:
	A47R L 8 A_PlayWeaponSound("weapons/legAK47Reload2")
	A47R MN 2 
	A47R OPQRS 1
	A47G A 2
	Goto Ready+7
  GrenadeCheck:
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,"GrenadeToss")
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	Goto Ready+7
  GrenadeToss:
  	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	A47S FEDCBA 1
	TNT1 A 4
	HGRN ABCDEFGHI 1
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadepin")
	HGRN JKLM 2
	TNT1 A 11
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	TNT1 A 0 A_TakeInventory("HandGrenadeAmmo",1,TIF_NOTAKEINFINITE)
	HGRN N 1 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
	HGRN OPQRS 1
	HGRN TU 2
	TNT1 A 6 A_TakeInventory("HandGrenadeAction",1)
	Goto Ready+1
  MineCheck:
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,"MineToss")
	TNT1 A 0 A_TakeInventory("MineAction",1)
	Goto Ready+7
  MineToss:
  	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	A47S FEDCBA 1
	TNT1 A 8
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	MINE ABCDEF 1
	TNT1 A 0 A_TakeInventory("MineAmmo",1,TIF_NOTAKEINFINITE)
	MINE G 1 A_FireCustomMissile("ThrownMine",0,0,0,0,false)
	MINE HI 1
	MINE JKLM 1
	TNT1 A 5 A_TakeInventory("MineAction",1)
	Goto Ready+1
  Spawn:
	A47I A -1
	Stop	
	}
}