ACTOR Flamethrower2 : BrutalWeapon
{
	Height 20
	Weapon.SelectionOrder 3200
	Weapon.AmmoUse 0
	Weapon.AmmoGive 50
	Weapon.AmmoType "Gas"
    Inventory.PickupSound "BFGREADY"
    +WEAPON.BFG
	+WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+WEAPON.EXPLOSIVE
	Inventory.PickupMessage "You got the Flamethrower (Slot 9)"
	Tag "Flamethrower"
	DropItem "FlameThrowerSpawner"
	States
	{
	Ready:
	Ready3:
	Reload:
		FLMT ABC 1 BRIGHT A_WeaponReady
		FLMT A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
        FLMT A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        FLMT A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		FLMT A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		FLMT A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		FLMT A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		FLMT A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Goto Ready3

	StartSprint:
		FLMT A 1 BRIGHT A_WeaponReady
		SHTN A 0 A_Takeinventory("Zoomed",1)
        SHTN A 0 A_ZoomFactor(1.0)
		SHTN A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_SetCrosshair(0)
		SHTN A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.

	Sprinting:
		FLMT A 1 BRIGHT offset(-9,34) A_SetPitch(pitch -0.5)
		FLMT B 1 BRIGHT offset(-6,36) A_SetPitch(pitch -0.5)
		FLMT C 1 BRIGHT offset(-3,38) A_SetPitch(pitch -0.5)
		FLMT A 1 BRIGHT offset(0,38) A_SetPitch(pitch -0.5)
		FLMT B 1 BRIGHT offset(3,36) A_SetPitch(pitch -0.5)
		FLMT C 1 BRIGHT offset(6,34) A_SetPitch(pitch -0.5)
		FLMT A 1 BRIGHT offset(9,32) A_SetPitch(pitch -0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")

		FLMT B 1 BRIGHT offset(9,34) A_SetPitch(pitch +0.5)
		FLMT C 1 BRIGHT offset(6,36) A_SetPitch(pitch +0.5)
		FLMT A 1 BRIGHT offset(3,38) A_SetPitch(pitch +0.5)
		FLMT B 1 BRIGHT offset(0,38) A_SetPitch(pitch +0.5)
		FLMT C 1 BRIGHT offset(-3,36) A_SetPitch(pitch +0.5)
		FLMT A 1 BRIGHT offset(-6,34) A_SetPitch(pitch +0.5)
		FLMT B 1 BRIGHT offset(-9,32) A_SetPitch(pitch +0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")

		PLAY A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.
		SMGG A 0 A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint

	StopSprint:
		FLMT A 0 A_JumpIfInventory("PowerStrength", 1, 2)
		FLMT A 0 A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		FLMT A 1 BRIGHT ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		Goto Ready

	StopSprintTired:
		FLMT A 1 BRIGHT ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		FLMT A 0 A_PlaySound("Tired", 2)
		Goto Ready

	DryFire:
	    FLMT ABCAC 1 BRIGHT A_StopSound(CHAN_WEAPON)
		FLMT A 0 A_PlaySound("weapons/empty")
		Goto Ready+6

	Deselect:
	    FLMT A 0 A_StopSound(CHAN_WEAPON)
		FLMT A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 0 A_TakeInventory("Unloading", 1)
		TNT1 A 0 A_TakeInventory("Reloading", 1)
		TNT1 A 0 A_TakeInventory("StartDualWield",1)
		TNT1 AAAAAAAAAAAA 0 A_Lower
		FLMT AAAA 1 BRIGHT A_Lower
		Loop
	Select:
		FLMT A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 A_TakeInventory("FistsSelected", 1)
		TNT1 A 0 A_TakeInventory("ShotgunSelected", 1)
		TNT1 A 0 A_TakeInventory("MinigunSelected", 1)
		TNT1 A 0 A_TakeInventory("SSGSelected", 1)
		TNT1 A 0 A_TakeInventory("RocketLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("GrenadeLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("PlasmaGunSelected", 1)
		TNT1 A 0 A_TakeInventory("RailGunSelected", 1)
		TNT1 A 0 A_TakeInventory("RevenantLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("SubMachineGunSelected", 1)
		TNT1 A 0 A_TakeInventory("BFG10KSelected", 1)
		TNT1 A 0 A_TakeInventory("BFGSelected", 1)
		TNT1 A 0 A_GiveInventory("FlameCannonSelected", 1)
		TNT1 A 0 A_TakeInventory("SawSelected", 1)
		FLMT A 0 A_Takeinventory("HasBarrel",1)
		FLMT A 0 A_TakeInventory("TossGrenade", 1)
		FLMT A 0 A_GunFlash
		FLMT AAAA 1 BRIGHT A_Raise
		FLMT A 0 A_PlaySound("BFGREADY")
		TNT1 AAAAAAAAAAAA 0 A_Raise
		Goto Ready

    Spawn:
        FLMT F -1
        Stop

   Fire:
        FLMT A 0
		FLMT A 0 A_JumpIf(waterlevel > 1, "DryFire")
        FLMT A 0 A_JumpIfInventory("Gas", 5, "Flamethrower")
		FLMT A 0 A_StopSound(CHAN_WEAPON)
		Goto DryFire

	Flamethrower:
		TNT1 A 0 A_FireCustomMissile("Alerter",0,0)
        FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissile", 0, 1, 0, 0, 0, 8)
		FLMT A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 5)

		FLMT A 0 A_JumpIfInventory("Gas", 4, 2)
		FLMT A 0 A_StopSound(CHAN_WEAPON)
		Goto DryFire
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, 0, 0, 8)
		FLMT A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 4)
		FLMT DE 1 BRIGHT

		FLMT A 0 A_JumpIfInventory("Gas", 6, 2)
		FLMT A 0 A_StopSound(CHAN_WEAPON)
		Goto DryFire
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, 0, 0, 8)
		FLMT A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 6)
		FLMT DE 1 BRIGHT

		FLMT A 0 A_JumpIfInventory("Gas", 5, 2)
		FLMT A 0 A_StopSound(CHAN_WEAPON)
		Goto DryFire
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, 0, 0, 8)
		FLMT A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 5)
		FLMT DE 1 BRIGHT

		FLMT A 0 A_JumpIfInventory("Gas", 5, 2)
		FLMT A 0 A_StopSound(CHAN_WEAPON)
		Goto DryFire
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissile", 0, 1, 0, 0, 0, 8)
		FLMT A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 5)

		FLMT A 0 A_JumpIfInventory("Gas", 6, 2)
		FLMT A 0 A_StopSound(CHAN_WEAPON)
		Goto DryFire
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, 0, 0, 8)
		FLMT A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 6)
		FLMT DE 1 BRIGHT

		FLMT A 0 A_JumpIfInventory("Gas", 4, 2)
		FLMT A 0 A_StopSound(CHAN_WEAPON)
		Goto DryFire
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, 0, 0, 8)
		FLMT A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 4)
		FLMT DE 1 BRIGHT

		FLMT A 0 A_JumpIfInventory("Gas", 5, 2)
		FLMT A 0 A_StopSound(CHAN_WEAPON)
		Goto DryFire
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, 0, 0, 8)
		FLMT A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 5)
		FLMT DE 1 BRIGHT
		FLMT A 0 A_Refire
		FLMT A 0 A_PlaySound("FLAMSTOP", CHAN_WEAPON)
		Goto Ready+6
	}
}
