ACTOR "Legendary Light Machine Gun" : Weapon 16603
{
//$Category Weapons/LCA
//$Sprite LMGLZ0
//$Title "Legendary Light Machine Gun"
Scale 0.95
Decal "LegBulletChip"
+WEAPON.NOALERT
+WEAPON.AMMO_OPTIONAL
-INVENTORY.UNDROPPABLE
Weapon.PreferredSkin "LegLMG-Marine"
Weapon.AmmoType "LLMGMagazine"
Weapon.AmmoType2 "LegendaryBulletMag"
Weapon.SelectionOrder 380
Weapon.KickBack 200
Weapon.AmmoGive 76
Weapon.AmmoGive2 20
Weapon.AmmoUse 1
Inventory.PickupSound "weapons/LMGReload3"
Inventory.PickupMessage "Legendary Light Machine Gun"
Obituary "%o was turned into swiss cheese by %k's Legendary Light Machine Gun."
States
	{
	Spawn:
		LMGL Z -1
		Loop
    Deselect:
		TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
		LMGG A 1 A_Lower
		Goto Deselect+1
	Select:
		TNT1 A 0 A_Raise
		Wait
	Ready:
		TNT1 A 0 A_PlayWeaponSound("weapons/LMGReload3")
		LMGG BCDEFA 1
		LMGG A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
		TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
		Goto Ready+7
	Fire:
	    TNT1 A 0 A_JumpIfNoAmmo("Empty")	
	    TNT1 A 0 A_PlaySound("weapons/LMGFire",5)
	    TNT1 A 0 A_AlertMonsters	
		TNT1 A 0 A_GunFlash
		TNT1 A 0 Radius_Quake(4,3,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
		LMGF A 3 Bright A_FireBullets(8.0,4.8,1,Random(98,100),"LegendaryASGBulletPuff")
		TNT1 A 0 A_Light0
		LMGF B 1
		LMGF C 1
		LMGG A 1
	    TNT1 A 0 A_JumpIfInventory("LLMGMagazine",1,1)
		Goto Ready+7
	    TNT1 A 0 A_PlaySound("weapons/LMGFire",5)
	    TNT1 A 0 A_AlertMonsters	
		TNT1 A 0 A_GunFlash
		TNT1 A 0 Radius_Quake(4,3,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
		LMGF D 3 Bright A_FireBullets(8.0,4.8,1,Random(98,100),"LegendaryASGBulletPuff")
		TNT1 A 0 A_Light0
		LMGF B 1
		LMGF C 1
		LMGG A 1
		TNT1 A 0 A_ReFire
		Goto Ready+7
	Flash:
		TNT1 A 0
		Goto LightDone
    Empty:
        LMGG A 10 A_PlayWeaponSound("weapons/click")
    AltFire:
  	    TNT1 A 0 A_JumpIfInventory("LLMGMagazine",76,2)
        TNT1 A 0 A_JumpIfInventory("LegendaryBulletMag",1,2)
		TNT1 A 0
		Goto Ready+7
		TNT1 A 0 A_JumpIfInventory("LLMGMagazine",1,"MaxReload")
	    LMGR A 1 A_PlayWeaponSound("weapons/LMGReload2")
 	    LMGR BCD 1
	    LMGR E 1 A_FireCustomMissile("LegendaryEmptyDrumSpawner", 0, 0, 0, 1)
	    LMGR F 1
		LMGR GG 25
		LMGR HIJK 1 A_PlayWeaponSound("weapons/LMGReload1")
	    LMGR L 8	
		LMGR MN 2
		LMGR OP 1
		LMGR QRSTU 1
		LMGR V 2
		LMGR W 3 A_PlayWeaponSound("weapons/LMGReload3")
		LMGR X 4
		LMGR Y 3
		LMGR Z 2
		TNT1 A 0 A_JumpIfInventory("LegendaryBulletMag",1,"Reload")
    Reload:
	    TNT1 A 0 A_TakeInventory("LegendaryBulletMag",1)
	    TNT1 A 0 A_GiveInventory("LLMGMagazine",1)
	    TNT1 A 0 A_JumpIfInventory("LLMGMagazine",75,2)
	    TNT1 A 0 A_JumpIfInventory("LegendaryBulletMag",1,"Reload")
		TNT1 A 0
		Goto Ready+7
	MaxReload:
	    LMGR A 1 A_PlayWeaponSound("weapons/LMGReload2")
 	    LMGR BCD 1
	    LMGR E 1 A_FireCustomMissile("LegendaryEmptyDrumSpawner",0,0,0,1)
	    LMGR F 1
		LMGR GG 17
		LMGR HIJK 1 A_PlayWeaponSound("weapons/LMGReload1")
	    TNT1 A 0 A_JumpIfInventory("LegendaryBulletMag",1,"Reload2")
    Reload2:
	    TNT1 A 0 A_TakeInventory("LegendaryBulletMag",1)
	    TNT1 A 0 A_GiveInventory("LLMGMagazine",1)
	    TNT1 A 0 A_JumpIfInventory("LLMGMagazine",76,"Full")
	    TNT1 A 0 A_JumpIfInventory("LegendaryBulletMag",1,"Reload2")
    Full:
	    LMGR L 8	
		LMGR MN 2
		LMGR OPQRS 1
	    LMGG 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") 
	    LMGR ABCDEFG 1
	    TNT1 A 4
		HGRN ABC 1
		HGRN D 2
		HGRN EFG 1
		HGRN HI 2
		TNT1 A 15 A_PlayWeaponSound("weapons/hgrenadepin")
		TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
		TNT1 A 0 A_TakeInventory("HandGrenadeAmmo",1,TIF_NOTAKEINFINITE)
		HGNE A 1 A_FireCustomMissile("ThrownGrenade",0,0,0,0,false)
		HGRN J 1
		HGRN KLM 2
		HGRN NO 1
		TNT1 A 6
		TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,2)
		TNT1 A 0// A_TakeInventory("Hand Grenade",1)
		TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
		TNT1 A 0
		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") 
	    LMGR ABCDEFG 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 JK 2
		TNT1 A 0 A_JumpIfInventory("MineAmmo",1,2)
		TNT1 A 0// A_TakeInventory("Land Mine",1)
		TNT1 A 0 A_TakeInventory("MineAction",1)
		TNT1 A 0
		TNT1 A 5
		Goto Ready+1
	}
}

ACTOR LegendaryBulletMag2 : LegendaryBulletMag replaces LegendaryLMGBulletMag { }

ACTOR LegendaryBulletBox2 : LegendaryBulletMag replaces LegendaryBulletBox
{
//$Category Ammunition/LCA
//$Sprite LCBXA0
//$Title "Legendary Box of Bullets"
	Scale 0.75
	Inventory.Amount 40
	Inventory.PickupMessage "Legendary Clip Box"
	Inventory.PickupSound "items/clipbox"
	Inventory.Icon "LCBXA0"
	+NOTIMEFREEZE
	States 
	{
	Spawn:
		LCBX A -1
		Stop
    }
}