// Gatling gun
actor GatlingGun : AOWWeapon 21045 {
    Weapon.BobSpeed 1.75
    Weapon.BobRangeX 0.2
    Weapon.BobRangeY 0.4
    Weapon.BobStyle Alpha
	Tag "Gatling Gun"
	Obituary "$OB_GATLING"
	Inventory.PickupMessage "You got the gatling gun!"
	Weapon.SelectionOrder 7
	Weapon.AmmoType "MachineGunAmmo"
	Weapon.AmmoUse 1
	Weapon.AmmoGive 25
	Weapon.AmmoType2 "MachineGunAmmo"
	Weapon.AmmoUse2 2
	Weapon.PreferredSkin "MarineChaingun"
	Weapon.UpSound "weapons/up/gatling"
	decal "BulletChip"
	States {
	Spawn:
		GATG X -1
		stop
    Select:
	    TNT1 A 0 A_JumpIfInventory("IsBlue",1,"Select.Blue")
		GATR A 1 offset (-90,100)
		GATR A 1 offset (-80,89)
		GATR A 1 offset (-70,79)
		GATR A 1 offset (-60,70)
		GATR A 1 offset (-50,62)
		GATR A 1 offset (-40,55)
		GATR A 1 offset (-30,49)
		GATR A 1 offset (-20,44)
		GATR A 1 offset (-15,40)
		GATR A 1 offset (-10,37)
		GATR A 1 offset (-5,34)
		GATR A 1 offset (0,0)
		TNT1 A 0 A_TakeInventory("SelectAnimation",1)
		goto ready
    Select.Blue:
		GATB A 1 offset (-90,100)
		GATB A 1 offset (-80,89)
		GATB A 1 offset (-70,79)
		GATB A 1 offset (-60,70)
		GATB A 1 offset (-50,62)
		GATB A 1 offset (-40,55)
		GATB A 1 offset (-30,49)
		GATB A 1 offset (-20,44)
		GATB A 1 offset (-15,40)
		GATB A 1 offset (-10,37)
		GATB A 1 offset (-5,34)
		GATB A 1 offset (0,0)
		TNT1 A 0 A_TakeInventory("SelectAnimation",1)
		goto ready
	Deselect:
	    TNT1 A 0 A_JumpIfInventory ("SpinGattlingGun", 1, "SpinDown")
	    TNT1 A 0 A_TakeInventory("ActionFragGrenade",1)	
        TNT1 A 0 A_TakeInventory("ActionFlashbang",1)
        TNT1 A 0 A_TakeInventory("ActionRemoteC4",1)	
        TNT1 A 0 A_TakeInventory("ActionMeleeAttack",1)
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		TNT1 A 0 A_JumpIfInventory("IsBlue",1,"DeselectBlue")
		GATR A 1 offset (-4,34)
		GATR A 1 offset (-8,40)
		GATR A 1 offset (-16,49)
		GATR A 1 offset (-24,62)
		GATR A 1 offset (-32,79)
		GATR A 1 offset (-40,100)
		TNT1 A 0 offset (-1, 33)
		TNT1 A 0 A_TakeInventory("PowerMinigunnerSpeed", 1)
		TNT1 A 0 A_Lower
		wait
	DeselectBlue:
	    GATB A 1 offset (-4,34)
		GATB A 1 offset (-8,40)
		GATB A 1 offset (-16,49)
		GATB A 1 offset (-24,62)
		GATB A 1 offset (-32,79)
		GATB A 1 offset (-40,100)
		TNT1 A 0 offset (-1, 33)
		TNT1 A 0 A_TakeInventory("PowerMinigunnerSpeed", 1)
		TNT1 A 0 A_Lower
		wait
	Ready:
	    TNT1 A 0 A_JumpIfInventory("SelectAnimation",1,"Select")
		TNT1 A 0 A_JumpIfInventory("SpinGattlingGun",1,"ReadySpin")
		TNT1 A 0 A_JumpIfInventory("IsBlue",1,"Ready.Blue")
		TNT1 A 0 A_JumpIfInventory("SpinGattlingGun", 1, "ReadySpin")
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_JumpIfInventory("ActionReload",1,"Reload")
		GATR A 1 A_WeaponReady
		loop
	Ready.Blue:
	    TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_JumpIfInventory("ActionReload",1,"Reload")
		GATB A 1 A_WeaponReady
		loop
    ReadySpin:
	    TNT1 A 0 A_JumpIfInventory ("IsBlue",1,"ReadySpin.Blue")
		TNT1 A 0 A_JumpIfInventory("JetpackActive",1,2)
		TNT1 A 0
		goto ReadySpin2
	    TNT1 A 0 A_PlaySound ("gatling/AltSpinIdle", CHAN_WEAPON)
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionReload",1,"Reload")
		TNT1 A 0 A_TakeInventory("PowerMinigunnerSpeed",1)
        GATR ABAB 1 offset (-19, 10) A_WeaponReady(WRF_NOBOB)
        loop
    ReadySpin.Blue:
		TNT1 A 0 A_JumpIfInventory("JetpackActive",1,2)
		TNT1 A 0
		goto ReadySpin2.Blue
	    TNT1 A 0 A_PlaySound ("gatling/AltSpinIdle", CHAN_WEAPON)
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionReload",1,"Reload")
		TNT1 A 0 A_TakeInventory("PowerMinigunnerSpeed",1)
        GATB ABAB 1 offset (-19, 10) A_WeaponReady(WRF_NOBOB)
        loop
    ReadySpin2:
	    TNT1 A 0 A_PlaySound ("gatling/AltSpinIdle", CHAN_WEAPON)
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionReload",1,"Reload")
		TNT1 A 0 A_GiveInventory ("MinigunnerSpeed", 1)
        GATR ABAB 1 offset (-19, 10) A_WeaponReady(WRF_NOBOB)
        goto ReadySpin
    ReadySpin2.Blue:
	    TNT1 A 0 A_PlaySound ("gatling/AltSpinIdle", CHAN_WEAPON)
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"SpinDownClass")
		TNT1 A 0 A_JumpIfInventory("ActionReload",1,"Reload")
		TNT1 A 0 A_GiveInventory ("MinigunnerSpeed", 1)
        GATB ABAB 1 offset (-19, 10) A_WeaponReady(WRF_NOBOB)
        goto ReadySpin.Blue
	Fire:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "Fire.Blue")
		TNT1 A 0 A_JumpIfInventory("SpinGattlingGun", 1, "FireSpin")
		TNT1 A 0 A_PlaySound ("gatling/spinup", CHAN_WEAPON)
		GATR A 3 A_JumpIfInventory("IsMinigunner",1,1)
		GATR B 1 offset (-1, 30)
		GATR B 1 offset (-2, 28)
		GATR B 1 offset (-3, 26)
		GATR B 1 offset (-5, 24)
		GATR B 1 offset (-7, 22)
		GATR A 1 offset (-9, 20)
		GATR A 1 offset (-11, 17)
		GATR A 1 offset (-14, 14)
		GATR A 1 offset (-17, 11)
		GATR B 3
        goto SpinDown
	Fire.Blue:
		TNT1 A 0 A_JumpIfInventory("SpinGattlingGun", 1, "FireSpin.Blue")
		TNT1 A 0 A_PlaySound ("gatling/spinup", CHAN_WEAPON)
		GATB A 3 A_JumpIfInventory("IsMinigunner",1,1)
		GATB B 1 offset (-1, 30)
		GATB B 1 offset (-2, 28)
		GATB B 1 offset (-3, 26)
		GATB B 1 offset (-5, 24)
		GATB B 1 offset (-7, 22)
		GATB A 1 offset (-9, 20)
		GATB A 1 offset (-11, 17)
		GATB A 1 offset (-14, 14)
		GATB A 1 offset (-17, 11)
		GATB B 3
        goto SpinDown
	Hold:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "Hold.Blue")
		GAFR A 1 offset (-19, 10) A_PlaySound ("minigun/loop", CHAN_WEAPON)
		TNT1 A 0 A_Light2
		TNT1 A 0 A_PlaySound ("minigun/fire2", 5)
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (9.6, 3.2, -1, 10, "RiflePuff", FBF_NORANDOM|FBF_USEAMMO, 2048)
		TNT1 A 0 A_SetPitch(pitch-0.4)
		GAFR B 1 offset (-17, 10) Bright
		TNT1 A 0 A_SetPitch(pitch+0.4)
		GAFR C 1 offset (-17, 8) Bright A_Light1
		TNT1 A 0 A_Light2
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (9.6, 3.2, -1, 10, "RiflePuff", FBF_NORANDOM|FBF_USEAMMO, 2048)
		TNT1 A 0 A_SetPitch(pitch-0.4)
		GAFR D 1 offset (-19, 8) A_Light1
		TNT1 A 0 A_SetPitch(pitch+0.4)
		TNT1 A 0 A_JumpIfNoAmmo ("SpinDown")
		TNT1 A 0 A_ReFire
		goto SpinDown
	Hold.Blue:
		GAFB A 1 offset (-19, 10) A_PlaySound ("minigun/loop", CHAN_WEAPON)
		TNT1 A 0 A_Light2
		TNT1 A 0 A_PlaySound ("minigun/fire2", 5)
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (9.6, 3.2, -1, 10, "RiflePuff", FBF_NORANDOM|FBF_USEAMMO, 2048)
		TNT1 A 0 A_SetPitch(pitch-0.4)
		GAFB B 1 offset (-17, 10) Bright
		TNT1 A 0 A_SetPitch(pitch+0.4)
		GAFB C 1 offset (-17, 8) Bright A_Light1
		TNT1 A 0 A_Light2
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (9.6, 3.2, -1, 10, "RiflePuff", FBF_NORANDOM|FBF_USEAMMO, 2048)
		TNT1 A 0 A_SetPitch(pitch-0.4)
		GAFB D 1 offset (-19, 8) A_Light1
		TNT1 A 0 A_SetPitch(pitch+0.4)	
		TNT1 A 0 A_JumpIfNoAmmo ("SpinDown")
		TNT1 A 0 A_ReFire
		goto SpinDown
	AltFire:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "Altfire.Blue")
		TNT1 A 0 A_JumpIfInventory("SpinGattlingGun", 1, "AltfireSpin")
		TNT1 A 0 A_PlaySound ("gatling/spinup", 5)
		GATR A 3 A_JumpIfInventory("IsMinigunner",1,1)
		GATR B 1 offset (-1, 30)
		GATR B 1 offset (-2, 28)
		GATR B 1 offset (-3, 26)
		GATR B 1 offset (-5, 24)
		GATR B 1 offset (-7, 22)
		GATR A 1 offset (-9, 20)
		GATR A 1 offset (-11, 17)
		GATR A 1 offset (-14, 14)
		GATR A 1 offset (-17, 11)
		GATR B 3
        goto SpinDown
	AltFire.Blue:
		TNT1 A 0 A_JumpIfInventory("SpinGattlingGun", 1, "AltfireSpin.Blue")
		TNT1 A 0 A_PlaySound ("gatling/spinup", 5)
		GATB A 3 A_JumpIfInventory("IsMinigunner",1,1)
		GATB B 1 offset (-1, 30)
		GATB B 1 offset (-2, 28)
		GATB B 1 offset (-3, 26)
		GATB B 1 offset (-5, 24)
		GATB B 1 offset (-7, 22)
		GATB A 1 offset (-9, 20)
		GATB A 1 offset (-11, 17)
		GATB A 1 offset (-14, 14)
		GATB A 1 offset (-17, 11)
		GATB B 3
		goto SpinDown
	AltHold:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "AltHold.Blue")
		TNT1 A 0 A_PlaySound ("gatling/alt", CHAN_WEAPON)
		TNT1 A 0 A_Light2
		TNT1 AA 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (2.6, 1.6, -1, 20, "ExplosionPuffSmall", FBF_NORANDOM|FBF_USEAMMO, 3072)
		GAFR A 1 bright offset (-17, 12) A_SetPitch(pitch-0.45)
		GAFR A 1 bright offset (-17, 16) A_SetPitch(pitch+0.45)
		TNT1 A 0 A_Light1
		GATR B 1 bright offset (-17, 15)
		GATR B 1 bright offset (-17, 13)
		GATR B 1 bright offset (-17, 11)
		TNT1 A 0 A_Light2
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (2.6, 1.6, -1, 20, "ExplosionPuffSmall", FBF_NORANDOM|FBF_USEAMMO, 3072)
		GAFR B 1 bright offset (-17, 13) A_SetPitch(pitch-0.45)
		GAFR B 1 bright offset (-17, 16) A_SetPitch(pitch+0.45)
		TNT1 A 0 A_Light1
		GATR A 1 bright offset (-17, 15)
		GATR A 1 bright offset (-17, 13)
		GATR A 1 bright offset (-17, 11)
		TNT1 A 0 A_JumpIfNoAmmo ("SpinDown")
		TNT1 A 0 A_ReFire
		goto SpinDown
	AltHold.Blue:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		TNT1 A 0 A_PlaySound ("gatling/alt", CHAN_WEAPON)
		TNT1 A 0 A_Light2
		TNT1 AA 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (2.6, 1.6, -1, 20, "ExplosionPuffSmall", FBF_NORANDOM|FBF_USEAMMO, 3072)
		GAFB A 1 bright offset (-17, 12) A_SetPitch(pitch-0.45)
		GAFB A 1 bright offset (-17, 16) A_SetPitch(pitch+0.45)
		TNT1 A 0 A_Light1
		GATB B 1 bright offset (-17, 15)
		GATB B 1 bright offset (-17, 13)
		GATB B 1 bright offset (-17, 11)
		TNT1 A 0 A_Light2
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (2.6, 1.6, -1, 20, "ExplosionPuffSmall", FBF_NORANDOM|FBF_USEAMMO, 3072)
		GAFB B 1 bright offset (-17, 13) A_SetPitch(pitch-0.45)
		GAFB B 1 bright offset (-17, 16) A_SetPitch(pitch+0.45)
		TNT1 A 0 A_Light1
		GATB A 1 bright offset (-17, 15)
		GATB A 1 bright offset (-17, 13)
		GATB A 1 bright offset (-17, 11)
		TNT1 A 0 A_JumpIfNoAmmo ("SpinDown")
		TNT1 A 0 A_ReFire
		goto SpinDown
	SpinDown:
	    TNT1 A 0 A_TakeInventory("SpinGattlingGun", 1)
	    TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "SpinDown.Blue")
		TNT1 A 0 A_Light0
		TNT1 A 0 A_PlaySound ("gatling/spin", CHAN_WEAPON)
		GATR A 1 offset (-17, 11) A_ReFire
		GATR A 1 offset (-15, 13) A_ReFire
		GATR B 1 offset (-13, 15) A_ReFire
		GATR B 1 offset (-11, 17) A_ReFire
		GATR B 1 offset ( -9, 20) A_ReFire
		GATR A 1 offset ( -7, 22) A_ReFire
		GATR A 1 offset ( -5, 24) A_ReFire
		GATR A 1 offset ( -3, 26) A_ReFire
		GATR A 1 offset ( -2, 28) A_ReFire
		GATR B 1 offset ( -1, 30) A_ReFire
		GATR B 4 offset (  0, 32) A_ReFire
		TNT1 A 0 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		GATR AAA 2 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		GATR BBB 2 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		GATR B 1
		goto Ready
	SpinDown.Blue:
		TNT1 A 0 A_Light0
		TNT1 A 0 A_PlaySound ("gatling/spin", CHAN_WEAPON)
		GATB A 1 offset (-17, 11) A_ReFire
		GATB A 1 offset (-15, 13) A_ReFire
		GATB B 1 offset (-13, 15) A_ReFire
		GATB B 1 offset (-11, 17) A_ReFire
		GATB B 1 offset ( -9, 20) A_ReFire
		GATB A 1 offset ( -7, 22) A_ReFire
		GATB A 1 offset ( -5, 24) A_ReFire
		GATB A 1 offset ( -3, 26) A_ReFire
		GATB A 1 offset ( -2, 28) A_ReFire
		GATB B 1 offset ( -1, 30) A_ReFire
		GATB B 4 offset (  0, 32) A_ReFire
		TNT1 A 0 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		GATB AAA 2 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		GATB BBB 2 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		GATB B 1
		goto Ready
	FireSpin:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "ReadySpin")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "ReadySpin")
		TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "FireSpin.Blue")
		GAFR A 1 offset (-19, 10)
		TNT1 A 0 A_Light2
		TNT1 A 0 A_PlaySound ("gatling/AltSpinFire", CHAN_WEAPON, 1.0, 1)
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (12.8, 3.2, 3, 5, "RiflePuff", FBF_NORANDOM|FBF_USEAMMO, 2048)
		TNT1 A 0 A_SetPitch(pitch-0.4)
		GAFR B 1 offset (-17, 10) Bright
		TNT1 A 0 A_SetPitch(pitch+0.4)
		GAFR C 1 offset (-17, 8) Bright A_Light1
		TNT1 A 0 A_Light2
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (12.8, 3.2, 3, 5, "RiflePuff", FBF_NORANDOM|FBF_USEAMMO, 2048)
		TNT1 A 0 A_SetPitch(pitch-0.4)
		GAFR D 1 offset (-19, 8) A_Light1
		TNT1 A 0 A_SetPitch(pitch+0.4)
		TNT1 A 0 A_JumpIfNoAmmo ("SpinDownClass")
		GAFR A 1 A_ReFire ("FireSpin")
		TNT1 A 0 A_StopSound (CHAN_WEAPON)
		goto Ready
	FireSpin.Blue:
		GAFB A 1 offset (-19, 10)
		TNT1 A 0 A_Light2
		TNT1 A 0 A_PlaySound ("gatling/AltSpinFire", CHAN_WEAPON, 1.0, 1)
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (12.8, 3.2, 3, 5, "RiflePuff", FBF_NORANDOM|FBF_USEAMMO, 2048)
		TNT1 A 0 A_SetPitch(pitch-0.4)
		GAFB B 1 offset (-17, 10) Bright
		TNT1 A 0 A_SetPitch(pitch+0.4)
		GAFB C 1 offset (-17, 8) Bright A_Light1
		TNT1 A 0 A_Light2
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (12.8, 3.2, 3, 5, "RiflePuff", FBF_NORANDOM|FBF_USEAMMO, 2048)
		TNT1 A 0 A_SetPitch(pitch-0.4)
		GAFB D 1 offset (-19, 8) A_Light1
		TNT1 A 0 A_SetPitch(pitch+0.4)
		TNT1 A 0 A_JumpIfNoAmmo ("SpinDownClass")
		GAFB A 1 A_ReFire ("FireSpin")
		TNT1 A 0 A_StopSound (CHAN_WEAPON)
		goto Ready
	AltfireSpin:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "AltfireSpin.Blue")
		TNT1 A 0 A_PlaySound ("gatling/alt", CHAN_WEAPON)
		TNT1 A 0 A_Light2
		TNT1 AA 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (6.4, 1.6, 3, 10, "ExplosionPuffSmall", FBF_NORANDOM|FBF_USEAMMO, 3072)
		GAFR A 1 bright offset (-17, 12) A_SetPitch(pitch-0.45)
		GAFR A 1 bright offset (-17, 16) A_SetPitch(pitch+0.45)
		TNT1 A 0 A_Light1
		GATR B 1 bright offset (-17, 15)
		GATR B 1 bright offset (-17, 13)
		GATR B 1 bright offset (-17, 11)
		TNT1 A 0 A_Light2
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (6.4, 1.6, 3, 10, "ExplosionPuffSmall", FBF_NORANDOM|FBF_USEAMMO, 3072)
		GAFR B 1 bright offset (-17, 13) A_SetPitch(pitch-0.45)
		GAFR B 1 bright offset (-17, 16) A_SetPitch(pitch+0.45)
		TNT1 A 0 A_Light1
		GATR A 1 bright offset (-17, 15)
		GATR A 1 bright offset (-17, 13)
		GATR A 1 bright offset (-17, 11)
		TNT1 A 0 A_JumpIfNoAmmo ("SpinDownClass")
		TNT1 A 0 A_ReFire ("AltfireSpin")
		goto ReadySpin
	AltfireSpin.Blue:
		TNT1 A 0 A_PlaySound ("gatling/alt", CHAN_WEAPON)
		TNT1 A 0 A_Light2
		TNT1 AA 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (6.4, 1.6, 3, 10, "ExplosionPuffSmall", FBF_NORANDOM|FBF_USEAMMO, 3072)
		GAFB A 1 bright offset (-17, 12) A_SetPitch(pitch-0.45)
		GAFB A 1 bright offset (-17, 16) A_SetPitch(pitch+0.45)
		TNT1 A 0 A_Light1
		GATB B 1 bright offset (-17, 15)
		GATB B 1 bright offset (-17, 13)
		GATB B 1 bright offset (-17, 11)
		TNT1 A 0 A_Light2
		TNT1 A 0 A_SpawnItemEx("RifleShellCasing",4,13,32,random(-2,-4),random(2,3),random(0,1),random(45,60),128)
		TNT1 A 0 A_FireBullets (6.4, 1.6, 3, 10, "ExplosionPuffSmall", FBF_NORANDOM|FBF_USEAMMO, 3072)
		GAFB B 1 bright offset (-17, 13) A_SetPitch(pitch-0.45)
		GAFB B 1 bright offset (-17, 16) A_SetPitch(pitch+0.45)
		TNT1 A 0 A_Light1
		GATB A 1 bright offset (-17, 15)
		GATB A 1 bright offset (-17, 13)
		GATB A 1 bright offset (-17, 11)
		TNT1 A 0 A_JumpIfNoAmmo ("SpinDownClass")
		TNT1 A 0 A_ReFire ("AltfireSpin")
		goto ReadySpin
    Reload:
        TNT1 A 0
	    TNT1 A 0 A_TakeInventory("ActionReload",1)
	    TNT1 A 0 A_JumpIfInventory("IsMinigunner",1,2)
	    Goto Ready
    SpinOnClass:
	    TNT1 A 0
        TNT1 A 0 A_JumpIfInventory("IsBlue",1,"SpinOnClass.Blue") 
 	    TNT1 A 0 A_JumpIfInventory("SpinGattlingGun", 1, "SpinDownClass")
 	    TNT1 A 0 A_GiveInventory("SpinGattlingGun", 1)
		TNT1 A 0 A_PlaySound ("gatling/AltSpinOn", CHAN_WEAPON)
		TNT1 A 0 A_JumpIfInventory("JetpackActive",1,2)
		TNT1 A 0 A_GiveInventory ("MinigunnerSpeed", 1)
		GATR BA 5
		GATR B 1 offset (-1, 30)
		GATR B 1 offset (-2, 28)
		GATR B 1 offset (-3, 26)
		GATR B 1 offset (-5, 24)
		GATR B 1 offset (-7, 22)
		GATR A 1 offset (-9, 20)
		GATR A 1 offset (-11, 17)
		GATR A 1 offset (-14, 14)
		GATR A 1 offset (-17, 11)
		GATR B 3
	    Goto ReadySpin
    SpinOnClass.Blue:
        TNT1 A 0 A_JumpIfInventory("SpinGattlingGun", 1, "SpinDownClass")
 	    TNT1 A 0 A_GiveInventory("SpinGattlingGun", 1)
		TNT1 A 0 A_PlaySound ("gatling/AltSpinOn", CHAN_WEAPON)
		TNT1 A 0 A_JumpIfInventory("JetpackActive",1,2)
		TNT1 A 0 A_GiveInventory ("MinigunnerSpeed", 1)
		GATB BA 5
		GATB B 1 offset (-1, 30)
		GATB B 1 offset (-2, 28)
		GATB B 1 offset (-3, 26)
		GATB B 1 offset (-5, 24)
		GATB B 1 offset (-7, 22)
		GATB A 1 offset (-9, 20)
		GATB A 1 offset (-11, 17)
		GATB A 1 offset (-14, 14)
		GATB A 1 offset (-17, 11)
		GATB B 3
	    Goto ReadySpin.Blue
	SpinDownClass:
	    TNT1 A 0 A_TakeInventory("SpinGattlingGun", 1)
	    TNT1 A 0 A_JumpIfInventory ("IsBlue", 1, "SpinDownClass.Blue")
		TNT1 A 0 A_Light0
		TNT1 A 0 A_PlaySound ("gatling/AltSpinOff", CHAN_WEAPON)
		GATR A 1 offset (-17, 11)
		GATR A 1 offset (-15, 13)
		GATR B 1 offset (-13, 15)
		GATR B 1 offset (-11, 17)
		GATR B 1 offset ( -9, 20)
		GATR A 1 offset ( -7, 22)
		GATR A 1 offset ( -5, 24)
		GATR A 1 offset ( -3, 26)
		GATR A 1 offset ( -2, 28)
		GATR B 1 offset ( -1, 30)
		GATR B 4 offset (  0, 32)
		GATR AB 6
		GATR B 1 A_TakeInventory ("PowerMinigunnerSpeed", 1)
		goto Ready
	SpinDownClass.Blue:
		TNT1 A 0 A_Light0
		TNT1 A 0 A_PlaySound ("gatling/AltSpinOff", CHAN_WEAPON)
		GATB A 1 offset (-17, 11)
		GATB A 1 offset (-15, 13)
		GATB B 1 offset (-13, 15)
		GATB B 1 offset (-11, 17)
		GATB B 1 offset ( -9, 20)
		GATB A 1 offset ( -7, 22)
		GATB A 1 offset ( -5, 24)
		GATB A 1 offset ( -3, 26)
		GATB A 1 offset ( -2, 28)
		GATB B 1 offset ( -1, 30)
		GATB B 4 offset (  0, 32)
		GATB AB 6
		GATB B 1 A_TakeInventory ("PowerMinigunnerSpeed", 1)
		goto Ready
	}
}

actor ExplosionPuff {
	+PUFFONACTORS
	+CLIENTSIDEONLY
	+NOINTERACTION
	DamageType "Explosion"
	States {
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("gatling/boom", CHAN_BODY, 1.0)
		TNT1 A 4 A_SpawnItemEx ("ExplosionSmall", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
		stop
	}
}

actor ExplosionPuffSmall : ExplosionPuff {
	states {
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("gatling/boom", CHAN_BODY, 0.6)
		TNT1 A 4 A_SpawnItemEx ("ExplosionSmaller", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
		stop
	}
}

actor PowerMinigunnerSpeed : PowerSpeed {
	speed 0.6
}

actor MinigunnerSpeed : PowerupGiver {
	+AUTOACTIVATE
	inventory.maxamount 0
	powerup.type "MinigunnerSpeed"
	powerup.duration 0x7fffffff // removed manually
	// powerup.color GoldMap, 0.25
	powerup.color 0, 0, 0, 0
	states {
	Spawn:
		TNT1 A 0
		stop
	}
}

ACTOR SpinGattlingGun : Inventory {Inventory.MaxAmount 1}