ACTOR SFortMinigun : Minigun
{
  Weapon.SelectionOrder 600
  Tag "Minigun"
  Decal "BulletChip"
  DamageType "Bullet"
  Inventory.RestrictedTo "GunnerPlayer"
  +WEAPON.NOAUTOAIM
  +WEAPON.NOLMS
  +WEAPON.ALLOW_WITH_RESPAWN_INVUL
  States
  {
  Deselect:
    TNT1 A 0 A_TakeInventory("PowerMinigunSlower",1)
    MNGG A 0 A_Lower
	Loop
  Ready:
    MNGG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
	Loop
  Select:
    MNGG A 1 A_Raise
	Loop
  Fire:
	TNT1 A 0 A_TakeInventory("PowerInvulnerable",1)
	TNT1 A 0 A_GiveInventory("PowerMinigunSlower")
	TNT1 A 0 A_Playsound("weapons/minirev",CHAN_5)
	MNGG BA 4
	MNGG BAB 3
  Hold:
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad1")
    TNT1 A 0 A_GunFlash("FlashLoop")
	TNT1 A 0 A_JumpIfNoAmmo("HoldNoAmmo")
	TNT1 A 0 A_GiveInventory("PowerMinigunSlower")
	//TNT1 A 0 A_GiveInventory("PowerMinigunProtection")
	TNT1 A 0 A_FireBullets(5.6, 3.5, -1, 9, "SFortBulletPuff",FBF_NORANDOM)
    MNGG A 2 Bright A_FireBullets(5.6, 3.5, -1, 6, "SFortBulletPuff",FBF_NORANDOM|FBF_USEAMMO)
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad2")
	TNT1 A 0 A_Playsound("weapons/miniloop",CHAN_5)
	TNT1 A 0 A_JumpIfNoAmmo("HoldNoAmmo")
	TNT1 A 0 A_FireBullets(5.6, 3.5, -1, 9, "SFortBulletPuff",FBF_NORANDOM)
    MNGG B 2 Bright A_FireBullets(5.6, 3.5, -1, 6, "SFortBulletPuff",FBF_NORANDOM|FBF_USEAMMO)
	TNT1 A 0 A_JumpIfNoAmmo("HoldNoAmmo")
    MNGG A 2 A_ReFire
    MNGG B 2 A_TakeInventory("PowerMinigunSlower",1)
	//TNT1 A 0 A_TakeInventory("PowerMinigunProtection",1)
    MNGG AABBAABBAABB 1 A_Refire
	MNGG AAABBBAAABBBAAABBBAAABBBAAABBB 1 A_WeaponReady(WRF_ALLOWRELOAD)
	MNGG AAAABBBBAAAABBBB 1 A_WeaponReady(WRF_ALLOWRELOAD)
	MNGG AAAAABBBBBAAAAABBBBB 1 A_WeaponReady(WRF_ALLOWRELOAD)
    Goto Ready
  HoldNoAmmo:
    MNGG ABABAB 2
	MNGG AAABBBAAABBBAAABBBAAABBBAAABBB 1 A_WeaponReady(WRF_ALLOWRELOAD)
	MNGG AAAABBBBAAAABBBB 1 A_WeaponReady(WRF_ALLOWRELOAD)
	MNGG AAAAABBBBBAAAAABBBBB 1 A_WeaponReady(WRF_ALLOWRELOAD)
	TNT1 A 0 A_Refire("Fire")
	Goto Hold+10
  Quad1:
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_7)
	Goto Hold+1
  Quad2:
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_7)
	Goto Hold+7
  FlashLoop:
    MNGF AB 2 BRIGHT A_Light1
    Goto LightDone
  Reload:
    TNT1 A 0 A_Print("$INFO_GUNNER",0.0625)
    Goto Ready
  }
}

ACTOR PowerMinigunSlower : PowerSpeed
{
  Powerup.Duration 0x7FFFFFFF
  Speed 0.5 //0.6666666667
  +POWERSPEED.NOTRAIL
}

ACTOR MinigunSlower : PowerupGiver
{
  -INVENTORY.INVBAR
  +INVENTORY.AUTOACTIVATE
  Powerup.Type MinigunSlower
  Inventory.Amount 1
  Inventory.MaxAmount 1
}

ACTOR PowerMinigunProtection : PowerProtection
{
	Powerup.Duration 0x7FFFFFFF
	DamageFactor "Normal", 0.8
}

ACTOR SFortSuperNailgun : Weapon
{
  Weapon.SelectionOrder 600
  Weapon.AmmoType "Clip"
  Weapon.AmmoUse 2
  Weapon.AmmoGive 40
  Inventory.PickupSound "misc/w_pkup"
  Inventory.PickupMessage "You got the super nailgun!"
  Inventory.RestrictedTo "GunnerPlayer"
  Tag "Super Nailgun"
  +WEAPON.NOAUTOAIM
  +WEAPON.NOLMS
  +WEAPON.ALLOW_WITH_RESPAWN_INVUL
  States
  {
  Spawn:
    NLMG F -1 Bright
    Loop
  Deselect:
    //TNT1 A 0 A_TakeInventory("PowerMinigunSlower",1)
    TNT1 A 0 A_Lower
    Loop
  Select:
    SNAI E 1 A_Raise
    Loop
  Ready:
    SNAI E 1 A_WeaponReady(WRF_ALLOWRELOAD)
    Loop
  Fire:
    TNT1 A 0 A_TakeInventory("PowerInvulnerable",1)
	//TNT1 A 0 A_GiveInventory("PowerMinigunSlower")
    SNAI D 3 A_PlaySound("weapons/snailstart",CHAN_5)
    SNAI A 3
    SNAI B 3
  Hold:
    TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad1")
	//TNT1 A 0 A_GiveInventory("PowerMinigunSlower")
    TNT1 A 0 A_GunFlash
    TNT1 A 0 A_PlaySound("weapons/snailfire",CHAN_WEAPON)
    SNAI C 2 Bright A_FireCustomMissile("BigNail",0,1,0,0)
    SNAI D 2
    TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad2")
    TNT1 A 0 A_PlaySound("weapons/snailspin",CHAN_5)
    TNT1 A 0 A_GunFlash
    TNT1 A 0 A_PlaySound("weapons/snailfire",CHAN_WEAPON)
    SNAI H 2 Bright A_FireCustomMissile("BigNail",0,1,0,-3)
    SNAI B 2
    SNAI E 2 A_Refire("Hold")
  FireEnd:
    SNAI D 2 //A_TakeInventory("PowerMinigunSlower",1)
    SNAI AB 2
    SNAI E 2 A_Refire("Hold")
    SNAI DAB 2 A_WeaponReady(WRF_NOPRIMARY)
    SNAI E 2 A_WeaponReady(WRF_NOPRIMARY)
    SNAI D 2 A_WeaponReady(WRF_ALLOWRELOAD)
    SNAI AB 2 A_WeaponReady(WRF_NOPRIMARY)
    SNAI E 3 A_WeaponReady(WRF_NOPRIMARY)
    SNAI D 3 A_WeaponReady(WRF_ALLOWRELOAD)
    SNAI AB 3 A_WeaponReady(WRF_NOPRIMARY)
    SNAI E 3 A_WeaponReady(WRF_NOPRIMARY)
    SNAI D 3 A_WeaponReady(WRF_ALLOWRELOAD)
    SNAI AB 3 A_WeaponReady(WRF_NOPRIMARY)
    SNAI E 4 A_WeaponReady(WRF_NOPRIMARY)
    SNAI D 4 A_WeaponReady(WRF_ALLOWRELOAD)
    SNAI AB 4 A_WeaponReady(WRF_NOPRIMARY)
    SNAI E 5 A_WeaponReady(WRF_NOPRIMARY)
    SNAI D 5 A_WeaponReady(WRF_ALLOWRELOAD)
    SNAI AB 5 A_WeaponReady(WRF_NOPRIMARY)
    Goto Ready
  Quad1:
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_7)
    Goto Hold+2
  Quad2:
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_7)
    Goto Hold+6
  Flash:
    TNT1 A 5 Bright A_Light1
    Goto LightDone
  Reload:
    TNT1 A 0 A_Print("$INFO_GUNNER",0.0625)
    Goto Ready
  }
}

ACTOR BigNail : Nail
{
  Damage (30)
  Speed 90
  Radius 2
  Height 2
  Scale 1
  Decal BigNail
  //Decal BigNailChip
  Obituary "%o was perforated by %k's super nailgun."
}

ACTOR GunnerFist : SFortFist
{
	Inventory.RestrictedTo "GunnerPlayer"
	States
	{
	Reload:
	  TNT1 A 0 A_Print("$INFO_GUNNER",0.0625)
	  Goto Ready
	}
}

ACTOR GunnerPistol : SFortPistol
{
	Inventory.RestrictedTo "GunnerPlayer"
	States
	{
	Reload:
	  TNT1 A 0 A_Print("$INFO_GUNNER",0.0625)//TNT1 A 0 ACS_NamedExecuteAlways("ClassInfo_Enter",0)
	  Goto Ready
	}
}

ACTOR GunnerShotgun : SFortShotgun
{
	Inventory.RestrictedTo "GunnerPlayer"
	States
	{
	Reload:
	  TNT1 A 0 A_Print("$INFO_GUNNER",0.0625)
	  Goto Ready
	}
}

ACTOR GunnerToken : Inventory {}