
ACTOR Flamethrower2 : BrutalWeapon
{
	Height 20
	Weapon.SelectionOrder 600
	Weapon.AmmoUse 0
	Weapon.AmmoGive 600
	Weapon.AmmoType "Gas"
    Inventory.PickupSound "BFGREADY"
     +WEAPON.NOAUTOAIM
	Inventory.PickupMessage "You got the Flamethrower (Slot 9)"
	Tag "Flamethrower"
	VisibleToPlayerClass BDoomer, Doomer2, TacticalDoomer, Purist
	Inventory.ForbiddenTo ""
	States
	{
	
	Ready:
	Ready3:
	Reload:
		FLMT ABC 1 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")
		FLMT A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		Goto Ready3
		
	CheckSprint:
		FLMT A 1 A_WeaponReady(WRF_NOFIRE)
		FLMT A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		FLMT A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready
		
	StartSprint:
		FLMT A 1 A_WeaponReady(WRF_NOFIRE)
		FLMT A 0 A_Takeinventory("Zoomed",1)
		FLMT A 0 A_Takeinventory("ADSmode",1)
		FLMT A 0 A_ZoomFactor(1.0)
		FLMT A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
	Sprinting:	
		FLMT A 0 offset(-9,32) 
		FLMT A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		FLMT A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
		FLMT A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		FLMT A 0 offset(-9,32) A_GiveInventory("UsedStamina", 15)
		FLMT A 0 offset(-9,32)
		FLMT A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		FLMT B 1 offset(-6,36) A_SetPitch(pitch -0.5)
		FLMT C 1 offset(-3,38) A_SetPitch(pitch -0.5)
		FLMT A 1 offset(0,38) A_SetPitch(pitch -0.5)
		FLMT B 1 offset(3,36) A_SetPitch(pitch -0.5)
		FLMT C 1 offset(6,34) A_SetPitch(pitch -0.5)
		FLMT A 1 offset(9,32) A_SetPitch(pitch -0.5)
		TNT1 C 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		FLMT A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        FLMT A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        FLMT A 0 A_JumpIfInventory("Reloading",1,"Reload")
		FLMT A 0 offset(-9,32) A_GiveInventory("UsedStamina", 8)
		FLMT A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		FLMT A 1 offset(9,34) A_SetPitch(pitch +0.5)
		FLMT A 1 offset(6,36) A_SetPitch(pitch +0.5)
		FLMT A 1 offset(3,38) A_SetPitch(pitch +0.5)
		FLMT A 1 offset(0,38) A_SetPitch(pitch +0.5)
		FLMT A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		FLMT A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		FLMT A 1 offset(-9,32) A_SetPitch(pitch +0.5)
		FLMT A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		FLMT A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint
		
	StopSprintTired:
		FLMT A 1
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		FLMT A 0 A_PlaySound("Tired", 2)
		FLMT A 0 A_TakeInventory("UsedStamina", 2)
		FLMT ABCAC 1 A_WeaponReady
		FLMT A 0 A_TakeInventory("UsedStamina", 2)
		FLMT ABCAC 1 A_WeaponReady
		FLMT A 0 A_TakeInventory("UsedStamina", 2)
		FLMT ABCAC 1 A_WeaponReady
		FLMT A 0 A_TakeInventory("UsedStamina", 2)
		FLMT ABCAC 1 A_WeaponReady
		FLMT A 0 A_TakeInventory("UsedStamina", 2)
		FLMT ABCAC 1 A_WeaponReady
		Goto Ready
	StopSprint:
		FLMT A 1
		FLMT A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready
		
	DryFire:
	    FLMT ABCAC 1
		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)
		FLMT A 1 A_Lower
		Loop
	Select:
		FLMT A 0 A_Giveinventory("GoSpecial",1)
		FLMT A 0 A_Takeinventory("FistsSelected",1)
		FLMT A 0 A_Takeinventory("SawSelected",1)
		FLMT A 0 A_Takeinventory("ShotgunSelected",1)
		FLMT A 0 A_Takeinventory("SSGSelected",1)
		FLMT A 0 A_Takeinventory("MinigunSelected",1)
		FLMT A 0 A_Takeinventory("PlasmaGunSelected",1)
		FLMT A 0 A_Takeinventory("RocketLauncherSelected",1)
		FLMT A 0 A_Takeinventory("GrenadeLauncherSelected",1)
		FLMT A 0 A_Takeinventory("BFGSelected",1)
		FLMT A 0 A_Takeinventory("BFG10kSelected",1)
		FLMT A 0 A_Takeinventory("RailGunSelected",1)
		FLMT A 0 A_Takeinventory("SubMachineGunSelected",1)
		FLMT A 0 A_Takeinventory("RevenantLauncherSelected",1)
		FLMT A 0 A_Takeinventory("LostSoulSelected",1)
		FLMT A 0 A_Giveinventory("FlameCannonSelected",1)
		FLMT A 0 A_Takeinventory("HasBarrel",1)
		FLMT A 0 A_TakeInventory("TossGrenade", 1)
		FLMT AAA 1 A_Raise
		
		FLMT A 0 A_PlaySound("BFGREADY")
        TNT1 AAA 0
		TNT1 AAAAAAAAA 0 A_Raise
		Goto SelectAnimation
		
	SelectAnimation:
		TNT1 A 1
		FLMT A 0 A_GunFlash
		Goto Ready
		
    Spawn:
        FLMT F 1
        Loop
		
   Fire:
        FLMT A 0
		FLMT A 0 A_JumpIf(waterlevel > 1, "DryFire")
        FLMT A 0 A_JumpIfInventory("Gas", 1, "Flamethrower")
		FLMT A 0 A_StopSound(CHAN_WEAPON)
		Goto DryFire
		
	Flamethrower:
        FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissile", 0, 1, 0, -12, 0, 8)
		TNT1 AAA 0 BRIGHT A_FireCustomMissile("Shotgunparticles2", random(-12,12), 0, 0, -2, 0, random(-9,9))
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		
		FLMT A 0 A_TakeInventory("Gas", 5)
		FLMT DE 1 BRIGHT A_SetAngle(random(1, -1) + angle)
		FLMT A 0 BRIGHT A_SetPitch(random(1, -1) + pitch)
		
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, -12, 0, 8)
		TNT1 AAA 0 BRIGHT A_FireCustomMissile("Shotgunparticles2", random(-12,12), 0, 0, -2, 0, random(-9,9))
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 4)
		FLMT DE 1 BRIGHT
		
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, -12, 0, 8)
		FLMT A 0 BRIGHT A_FireCustomMissile("Shotgunparticles2", random(-12,12), 0, 0, -2, 0, random(-9,9))
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 6)
		FLMT DE 1 BRIGHT
		
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, -12, 0, 8)
		FLMT A 0 BRIGHT A_FireCustomMissile("Shotgunparticles2", random(-12,12), 0, 0, -2, 0, random(-9,9))
		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_TakeInventory("Gas", 5)
		FLMT DE 1 BRIGHT A_SetAngle(random(1, -1) + angle)
		FLMT A 0 BRIGHT A_SetPitch(random(1, -1) + pitch)
		
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, -12, 0, 8)
		TNT1 AAA 0 BRIGHT A_FireCustomMissile("Shotgunparticles2", random(-12,12), 0, 0, -2, 0, random(-9,9))
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 6)
		FLMT DE 1 BRIGHT
		
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, -12, 0, 8)
		FLMT A 0 BRIGHT A_FireCustomMissile("Shotgunparticles2", random(-12,12), 0, 0, -2, 0, random(-9,9))
		FLMT A 0 A_PlaySound("FLAMER", CHAN_WEAPON, 1, 1)
		FLMT A 0 A_TakeInventory("Gas", 4)
		FLMT DE 1 BRIGHT
		
		FLMT A 0 BRIGHT A_FireCustomMissile("FlamethrowerMissileProper", 0, 1, 0, -12, 0, 8)
		FLMT A 0 BRIGHT A_FireCustomMissile("Shotgunparticles2", random(-12,12), 0, 0, -2, 0, random(-9,9))
		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
	}
}
