ACTOR "LegendaryMinigun" : Weapon
{
   Weapon.Selectionorder 690
   Weapon.KickBack 50
   Weapon.PreferredSkin "ExplosiveMinigun-Marine"
   Weapon.AmmoType "LegendaryLMGBulletMag"
   Weapon.AmmoGive 60
   Weapon.AmmoUse 1
   Weapon.UpSound "EnrLegMinigun/up"
   Inventory.PickupSound "EnrLegMiniPickup/pickup"
   Inventory.PickupMessage "Legendary Minigun"
   Obituary "%o was ripped to bloody chunks by %k's Legendary Minigun."
   AttackSound "EnrLegMinigun/despacito"
   +INVENTORY.UNDROPPABLE
   +WEAPON.NOAUTOAIM
   States 
   {
   Spawn:
      LMIC X -1
      Stop
   Ready:
      LMIC A 1 A_WeaponReady
      Loop
   ReadySpin:
      TNT1 A 0 A_PlaySound("weapons/expmgunspin", 5)
      LMIC ABCDEFGHABCDEFGHABCDEFGH 1 A_WeaponReady
      Loop
   Deselect:
      TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	  TNT1 A 0 A_TakeInventory("MineAction",1)
	  TNT1 A 0 A_TakeInventory("RailgunAction",1)
	  TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
      TNT1 A 0 A_TakeInventory("ExpLegendaryMinigunActive2",1)
      TNT1 A 0 A_TakeInventory("ExpLegendaryMinigunActive",1)
      TNT1 A 0 A_PlaySound("weapons/weapondown", 5)
   Deselecting:
      LMIC A 1 A_Lower
      TNT1 A 0 A_Lower
      Loop
   Select:
      TNT1 A 0 A_TakeInventory("ExpLegendaryMinigunActive2",1)
      TNT1 A 0 A_TakeInventory("ExpLegendaryMinigunActive",1)
   Selecting:
      LMIC A 1 A_Raise
      TNT1 A 0 A_Raise
      Loop
   Fire:
      TNT1 A 0 A_JumpIfNoAmmo("EmptySpinDown")   
      TNT1 A 0 A_JumpIfInventory("ExpLegendaryMinigunActive2",1,"Firing")
      TNT1 A 0 A_JumpIfInventory("ExpLegendaryMinigunActive",1,"Firing")
      TNT1 A 0 A_PlaySound("weapons/expmgunspinstart", 5)
      LMIC ABC 2
      LMIC DABCDABC 1
   Firing:
      TNT1 A 0 A_GiveInventory("ExpLegendaryMinigunActive",1)
      TNT1 A 0 A_PlaySound("weapons/expmgunspin", 5)
      TNT1 A 0 Radius_Quake(2,2,0,1,0)
      TNT1 A 0 A_SpawnItemEx("BlueShellCasing",25,-8,25,Random(2,4),Random(-3,-6),Random(3,6),0)
      TNT1 A 0 A_PlaySound("sentient/fire", CHAN_WEAPON)
      TNT1 A 0 A_FireCustomMissile("PlayerLegSentientExplosiveTracer",Random(4,-4),0,0,Random(4,-4))
      LMIF A 1 Bright A_FireBullets(4.8,2.4,-1,Random(6,10),"ModdedBulletPuff")
      TNT1 A 0 A_JumpIfNoAmmo("EmptySpinDown")   
      LMIF IJ 1 Bright
      TNT1 A 0 Radius_Quake(2,2,0,1,0)
      TNT1 A 0 A_SpawnItemEx("BlueShellCasing",25,-8,25,Random(2,4),Random(-3,-6),Random(3,6),0)
      TNT1 A 0 A_PlaySound("sentient/fire", CHAN_WEAPON)   
      TNT1 A 0 A_FireCustomMissile("PlayerLegSentientExplosiveTracer",Random(4,-4),0,0,Random(4,-4))
      LMIF L 1 Bright A_FireBullets(4.8,2.4,-1,Random(6,10),"ModdedBulletPuff")
      LMIF I 1 Bright
   Hold:
      TNT1 A 0 A_GiveInventory("ExpLegendaryMinigunActive",1)
      TNT1 A 0 A_PlaySound("weapons/expmgunspin", 5)
      TNT1 A 0 Radius_Quake(2,2,0,1,0)
      TNT1 A 0 A_SpawnItemEx("BlueShellCasing",25,-8,25,Random(2,4),Random(-3,-6),Random(3,6),0)
      TNT1 A 0 A_PlaySound("sentient/fire", CHAN_WEAPON)
      TNT1 A 0 A_FireCustomMissile("PlayerLegSentientExplosiveTracer",Random(4,-4),0,0,Random(4,-4))
      LMIF J 1 Bright A_FireBullets(4.8,2.4,-1,Random(6,10),"ModdedBulletPuff")
      TNT1 A 0 A_JumpIfNoAmmo("EmptySpinDown")
      LMIF L 1 Bright
      LMIF HI 1 Bright
      TNT1 A 0 Radius_Quake(2,2,0,1,0)
      TNT1 A 0 A_SpawnItemEx("BlueShellCasing",25,-8,25,Random(2,4),Random(-3,-6),Random(3,6),0)
      TNT1 A 0 A_PlaySound("sentient/fire", CHAN_WEAPON)   
      TNT1 A 0 A_FireCustomMissile("PlayerLegSentientExplosiveTracer",Random(4,-4),0,0,Random(4,-4))
      LMIF J 1 Bright A_FireBullets(4.8,2.4,-1,Random(6,10),"ModdedBulletPuff")
      TNT1 A 0 A_JumpIfNoAmmo("EmptySpinDown")   
      LMIF KL 1 Bright
      TNT1 A 0 Radius_Quake(2,2,0,1,0)
      TNT1 A 0 A_SpawnItemEx("BlueShellCasing",25,-8,25,Random(2,3),Random(-3,-5),Random(3,5),0)
      TNT1 A 0 A_PlaySound("sentient/fire", CHAN_WEAPON)   
      TNT1 A 0 A_FireCustomMissile("PlayerLegSentientExplosiveTracer",Random(4,-4),0,0,Random(4,-4))
      LMIF I 1 Bright A_FireBullets(4.8,2.4,-1,Random(6,10),"ModdedBulletPuff")
      TNT1 A 0 A_JumpIfNoAmmo("EmptySpinDown")   
      TNT1 A 0 A_ReFire
      TNT1 A 0 A_JumpIfInventory("ExpLegendaryMinigunActive2",1,"ReadySpin")
      TNT1 A 0 A_PlaySound("weapons/expmgunspinstop", 5)
      TNT1 A 0 A_TakeInventory("ExpLegendaryMinigunActive",1)
      LMIC ABCDABCD 1
      LMIC ABCD 2
      LMIC ABCD 3
      Goto Ready
   AltFire:
      TNT1 A 0
      TNT1 A 0 A_JumpIfInventory("ExpLegendaryMinigunActive2",1,"EmptySpinDown")
      TNT1 A 0 A_PlaySound("weapons/expmgunspinstart", 5)
      LMIC ABC 2
      LMIC DCBADCBA 1
      TNT1 A 0 A_GiveInventory("ExpLegendaryMinigunActive2",1)
      Goto ReadySpin
   EmptySpinDown:
      TNT1 A 0 A_TakeInventory("ExpLegendaryMinigunActive",1)
      TNT1 A 0 A_TakeInventory("ExpLegendaryMinigunActive2",1)
      TNT1 A 0 A_PlaySound("weapons/expmgunspinstop", 5)
      LMIC ABCDABCD 1
      LMIC ABCD 2
      LMIC ABCD 3
      Goto Ready
   }
}

ACTOR ExpLegendaryMinigunActive : Ammo
{
   Inventory.MaxAmount 1
}
ACTOR ExpLegendaryMinigunActive2 : Ammo
{
   Inventory.MaxAmount 1
}

ACTOR PlayerLegSentientExplosiveTracer : SentientExplosiveTracer
{
   Species "Player"
   DamageType "LegendaryPlayer"
   +THRUSPECIES
   Scale 0.7
   States
   {
   Spawn:
      LRAC A 1 Bright
      Loop
   }
}