ACTOR SSTMinigun : Minigun Replaces Minigun
{
  Tag "Minigun"
  DamageType "NewBullet"
  SpawnID 214
  Radius 20
  Height 16
  Weapon.AmmoType "Clip" 
  Weapon.AmmoGive 20
  Weapon.AmmoUse 1
  //+NOAUTOFIRE
  Weapon.Selectionorder 699
  Weapon.Kickback 100
  Inventory.PickupMessage "$PICKUP_MINIGUN" // "%o was drilled by %k's minigun."
  Obituary "You got the minigun!"
  //AttackSound "weapons/minigun"
  AttackSound "misc/none"
  Decal "bulletchip"
  Weapon.preferredSkin "MinigunSkin"
  +NOALERT
	+FORCEXYBILLBOARD
  States
  {
  Spawn:
    MNGP A -1
    Loop
  Ready:
    MNGG A 1 A_WeaponReady
	TNT1 A 0 A_ZoomFactor(1)
    Loop
  Deselect:
	TNT1 A 0 A_ZoomFactor(1)
    RLGG F 0 A_TakeInventory("SpinCheck", 1)
    MNGG A 0 A_StopSoundEx("soundslot7")
    TNT1 A 0 ACS_ExecuteAlways(779,0, 2,0,0)
    TNT1 A 0
    MNGG A 1 A_Lower
    Goto DeSelect+4
  Select:
    RLGG F 0 A_TakeInventory("SpinCheck", 1)
    TNT1 A 0 A_JumpIfInventory("InstantSwitch",1, "Ready")
    TNT1 A 0 ACS_ExecuteAlways(779,0, 5,0,0)
    TNT1 A 0
    MNGG A 1 A_Raise 
    Goto Select+4
  Fire: 
    RLGG F 0 A_JumpIfInventory("SpinCheck", 1, "hold")
    MNGG B 4 A_PlaySoundEx("weapons/minigunspin1", "soundslot7")
    MNGG C 4
    MNGG DA 4
    MNGG BC 2
    MNGG DA 2
    MNGG BCD 1 //A_PlaySoundEx("weapons/minigunspin3", "Item")
    RLGG F 0 A_GiveInventory("SpinCheck", 1)
    MNGG A 0 A_PlaySoundEx("weapons/minigunspin3", "soundslot7",1)
  Hold: 
    MNGG F 0 A_JumpIfInventory("RuneDoubleFiringSpeed", 1, "holdfast")
    MNGG A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(random(1,2),4,0,1, 0)
    MNGF A 1 BRIGHT
    MNGF B 1 BRIGHT 
	TNT1 A 0 Radius_Quake(random(1,2),4,0,1, 0)
    MNGF C 1 BRIGHT
    MNGG D 1
    MNGG A 0 A_ReFire
    MNGG AB 1 A_WeaponReady
    MNGG A 0 A_StopSoundEx("soundslot7")
    MNGG A 0 A_PlaySoundEx("weapons/minigunspin2", "soundslot7")
    MNGG CD 1 A_WeaponReady
    MNGG ABCD 2 A_WeaponReady
    MNGG ABCD 3 A_WeaponReady
    MNGG A 4 A_WeaponReady
    RLGG F 0 A_TakeInventory("SpinCheck", 1)
    MNGG BCD 4 A_WeaponReady
    MNGG ABCD 5 A_WeaponReady
    MNGG A 0 A_ReFire
    Goto Ready 
  AltFire: 
    RLGG F 0 A_JumpIfInventory("SpinCheck", 1, "Althold")
    MNGG B 4 A_PlaySoundEx("weapons/minigunspin1", "soundslot7")
    MNGG C 4
    MNGG DA 4
    MNGG BC 2
    MNGG DA 2
    MNGG BCD 1 //A_PlaySoundEx("weapons/minigunspin3", "Item")
    RLGG F 0 A_GiveInventory("SpinCheck", 1)
    MNGG A 0 A_PlaySoundEx("weapons/minigunspin3", "soundslot7",1)
  AltHold: 
    MNGG A 0 A_PlaySoundEx("weapons/minigunspin3", "soundslot7",1)
    MNGG AB 1 A_WeaponReady(8)
    MNGG CD 1 A_WeaponReady(8)
    MNGG A 0 A_ReFire
    MNGG AB 1 A_WeaponReady
    MNGG A 0 A_StopSoundEx("soundslot7")
    MNGG A 0 A_PlaySoundEx("weapons/minigunspin2", "soundslot7")
    MNGG CD 1 A_WeaponReady
    MNGG ABCD 2 A_WeaponReady
    MNGG ABCD 3 A_WeaponReady
    MNGG A 4 A_WeaponReady
    RLGG F 0 A_TakeInventory("SpinCheck", 1)
    MNGG BCD 4 A_WeaponReady
    MNGG ABCD 5 A_WeaponReady
    MNGG A 0 A_ReFire
    Goto Ready 
  HoldFast: 
    MNGG A 0 A_GunFlash
    MNGG A 0 A_PlaySoundEx("weapons/minigunspin3", "soundslot7")
    MNGF A 1 BRIGHT
    MNGF C 1 BRIGHT
    MNGG A 1 A_ReFire
    MNGG B 1
    //MNGG A 0 A_StopSoundEx("Item")
    MNGG A 0 A_PlaySoundEx("weapons/minigunspin2", "soundslot7")
    MNGG CD 1 A_WeaponReady
    MNGG AB 2 A_WeaponReady
    MNGG CD 2 A_WeaponReady
    MNGG AB 4 A_WeaponReady
    MNGG CD 4 A_WeaponReady
    RLGG F 0 A_TakeInventory("SpinCheck", 1)
    MNGG A 0 A_ReFire
    Goto Ready 
  Flash: 
    MNGF F 0 A_JumpIfInventory("RuneDoubleFiringSpeed", 1, "Flashfast")
    MNGF A 0 A_Jump(56, "FlashA")
    MNGF A 0 A_FireBullets(8, 6, -1, random(5.0,6.0), "SSTBulletpuff1")
    SHT2 A 0 A_PlaySoundEx("weapons/minigun", "Weapon")
    NULL A 0 A_SpawnItemEx ("MinigunEcho", 0,0,0, 0,0,0, 0, 160)
	  TNT1 A 0 A_FireCustomMissile ("TracerRound", random(-8,8)*0.4, 0, 0, 0, 0, random(-6,6)*0.4)
	TNT1 A 0 A_ZoomFactor(0.95)
    TNT1 A 1 BRIGHT A_Light2 
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-8)
    TNT1 A 0 ACS_ExecuteAlways(925,0, random(40,85),0,0)
	TNT1 A 0 A_ZoomFactor(0.96)
    TNT1 A 1 BRIGHT A_Light1 
    TNT1 A 0 BRIGHT A_Light0
    RLGG E 0 A_AlertMonsters
	Goto Flash2
  Flash2:
    RLGG F 0 A_JumpIfInventory("RuneDoubleFiringSpeed", 1, "Flash2fast")
    MNGF A 0 A_Jump(56, "Flash2A")
    RLGG E 0 a_jumpifnoammo("lightdone") //A_CheckReload
    MNGF B 0 A_FireBullets(10, 6, -1, random(5.0,6.0), "SSTBulletpuff1")
	  TNT1 A 0 A_FireCustomMissile ("TracerRound", random(-10,10)*0.4, 0, 0, 0, 0, random(-6,6)*0.4)
    SHT2 A 0 A_PlaySoundEx("weapons/minigun", "Weapon")
    NULL A 0 A_SpawnItemEx ("MinigunEcho", 0,0,0, 0,0,0, 0, 160)
	TNT1 A 0 A_ZoomFactor(0.96)
    TNT1 B 1 BRIGHT A_Light2
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-8)
    TNT1 A 0 ACS_ExecuteAlways(925,0, random(0,80),0,0)
	TNT1 A 0 A_ZoomFactor(0.97)
    TNT1 A 1 BRIGHT A_Light1 
    TNT1 A 0 BRIGHT A_Light0
	TNT1 A 0 A_ZoomFactor(1)
    Stop 
  FlashA: 
    RLGG F 0 A_JumpIfInventory("RuneDoubleFiringSpeed", 1, "FlashAfast")
    MNGF A 0 A_FireBullets(5, 5, -1, random(6.0,7.0), "SSTBulletpuff1")
	  TNT1 A 0 A_FireCustomMissile ("TracerRound", random(-5,5)*0.4, 0, 0, 0, 0, random(-5,5)*0.4)
    SHT2 A 0 A_PlaySoundEx("weapons/minigun", "Weapon")
    NULL A 0 A_SpawnItemEx ("MinigunEcho", 0,0,0, 0,0,0, 0, 160)
    G36F A 0 A_FireCustomMissile ("TracerRound", random(-2,2), 0, 0, random(-3,-1))
	TNT1 A 0 A_ZoomFactor(0.97)
    TNT1 A 1 BRIGHT A_Light2 
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-8)
    TNT1 A 0 ACS_ExecuteAlways(925,0, random(8,100),0,0)
	TNT1 A 0 A_ZoomFactor(0.98)
    TNT1 A 1 BRIGHT A_Light1 
    TNT1 A 0 BRIGHT A_Light0
    RLGG E 0 A_AlertMonsters
	Goto Flash2
  Flash2A:
    RLGG F 0 A_JumpIfInventory("RuneDoubleFiringSpeed", 1, "Flash2Afast")
    RLGG E 0 a_jumpifnoammo("lightdone") //A_CheckReload
    MNGF B 0 A_FireBullets(5, 5, -1, random(6.0,7.0), "SSTBulletpuff1")
	  TNT1 A 0 A_FireCustomMissile ("TracerRound", random(-5,5)*0.4, 0, 0, 0, 0, random(-5,5)*0.4)
    SHT2 A 0 A_PlaySoundEx("weapons/minigun", "Weapon")
    NULL A 0 A_SpawnItemEx ("MinigunEcho", 0,0,0, 0,0,0, 0, 160)
	TNT1 A 0 A_ZoomFactor(0.98)
    TNT1 B 1 BRIGHT A_Light2
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-8)
    TNT1 A 0 ACS_ExecuteAlways(925,0, random(8,100),0,0)
	TNT1 A 0 A_ZoomFactor(0.99)
    TNT1 A 1 BRIGHT A_Light1 
    TNT1 A 0 BRIGHT A_Light0
	TNT1 A 0 A_ZoomFactor(1)
    Stop 
	
  FlashFast: 
    MNGF A 0 A_Jump(56, "FlashA")
    MNGF A 0 A_FireBullets(12, 8, -1, random(5.0,6.0), "SSTBulletpuff1")
	  TNT1 A 0 A_FireCustomMissile ("TracerRound", random(-12,12)*0.4, 0, 0, 0, 0, random(-8,8)*0.4)
    SHT2 A 0 A_PlaySoundEx("weapons/minigun", "Weapon")
    NULL A 0 A_SpawnItemEx ("MinigunEcho", 0,0,0, 0,0,0, 0, 160)
    G36F A 0 A_FireCustomMissile ("TracerRound", random(-2,2), 0, 0, random(-3,-1))
    TNT1 A 1 BRIGHT A_Light2 
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-8)
    TNT1 A 0 BRIGHT A_Light0
    RLGG E 0 A_AlertMonsters
	Goto Flash2
  Flash2Fast:
    MNGF A 0 A_Jump(56, "Flash2A")
    RLGG E 0 a_jumpifnoammo("lightdone") //A_CheckReload
    MNGF B 0 A_FireBullets(12, 8, -1, random(5.0,6.0), "SSTBulletpuff1")
	  TNT1 A 0 A_FireCustomMissile ("TracerRound", random(-12,12)*0.4, 0, 0, 0, 0, random(-8,8)*0.4)
    SHT2 A 0 A_PlaySoundEx("weapons/minigun", "Weapon")
    NULL A 0 A_SpawnItemEx ("MinigunEcho", 0,0,0, 0,0,0, 0, 160)
    TNT1 B 1 BRIGHT A_Light2
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-8)
    TNT1 A 0 ACS_ExecuteAlways(925,0, random(0,100),0,0)
    TNT1 A 0 BRIGHT A_Light0
    Stop 
  FlashAFast: 
    MNGF A 0 A_FireBullets(8, 4, -1, random(6.0,7.0), "SSTBulletpuff1")
	  TNT1 A 0 A_FireCustomMissile ("TracerRound", random(-8,8)*0.4, 0, 0, 0, 0, random(-4,4)*0.4)
    SHT2 A 0 A_PlaySoundEx("weapons/minigun", "Weapon")
    NULL A 0 A_SpawnItemEx ("MinigunEcho", 0,0,0, 0,0,0, 0, 160)
    G36F A 0 A_FireCustomMissile ("TracerRound", random(-2,2), 0, 0, random(-3,-1))
    TNT1 A 1 BRIGHT A_Light2 
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-8)
    TNT1 A 0 ACS_ExecuteAlways(925,0, random(40,60),0,0)
    TNT1 A 0 BRIGHT A_Light0
    RLGG E 0 A_AlertMonsters
	Goto Flash2
  Flash2AFast:
    RLGG E 0 a_jumpifnoammo("lightdone") //A_CheckReload
    MNGF B 0 A_FireBullets(8, 4, -1, random(6.0,7.0), "SSTBulletpuff1")
	  TNT1 A 0 A_FireCustomMissile ("TracerRound", random(-8,8)*0.4, 0, 0, 0, 0, random(-4,4)*0.4)
    SHT2 A 0 A_PlaySoundEx("weapons/minigun", "Weapon")
    NULL A 0 A_SpawnItemEx ("MinigunEcho", 0,0,0, 0,0,0, 0, 160)
    TNT1 B 1 BRIGHT A_Light2
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-8)
    TNT1 A 0 ACS_ExecuteAlways(925,0, random(60,100),0,0)
    TNT1 A 0 BRIGHT A_Light0
    Stop 
  }
}

actor SpinCheck : Inventory
{
  inventory.amount 1
  inventory.maxamount 1
}