actor flamethrower1 : DoomWeapon replaces rocketlauncher
{
  Game Doom
  SpawnID 30
  Weapon.SelectionOrder 100
  Weapon.AmmoType1 "FlamethrowerLoaded"
  Weapon.AmmoType2 "Fuel"
  Weapon.AmmoGive1 150
  Weapon.AmmoGive2 150
  Weapon.AmmoUse 1
  +Weapon.Ammo_Optional
  +Weapon.Explosive
  +WEAPON.NOAUTOAIM
  Weapon.BobSpeed 2.5
  Weapon.BobRangeY 0.3
  Weapon.BobRangeX 0.0
  weapon.upsound "flameup"
  scale 0.20
  Inventory.PickupMessage "You got the flamethrower!"
  States
  {
  Ready:
    FLAM A 1 A_WeaponReady
	TNT1 A 0 A_JumpifNoAmmo("LowFuelReady")
	TNT1 A 0 A_PlayWeaponSound("FLAMETHR")
	TNT1 A 0 A_Jumpifinventory("FlamethrowerLoaded", 40, "RealReady")
	Goto LowFuelReady
	RealReady:
	FLAM A 2 A_WeaponReady(WRF_ALLOWRELOAD)
	TNT1 A 0 	
    Loop
  LowFuelReady:
    TNT1 A 0 A_JumpifNoAmmo("DryFuel")
    FLAM A 2 A_WeaponReady(WRF_ALLOWRELOAD)
	TNT1 A 0
    Loop
	Dryfuel:
	FLAM A 15 A_WeaponReady(WRF_ALLOWRELOAD)
	TNT1 A 0 	
	Loop
	Dryfire:
	FLAM A 15 A_PlayWeaponSound("DRYFIRE")
	Goto Reload 	
  Deselect:
    FLAM A 0 A_playsound("flamedn")
    FLAM A 1 A_Lower
    goto Deselect+1
  Select:
    FLAM A 1 A_Raise
    Loop
  Fire:
	TNT1 A 0 A_JumpIfNoAmmo("Dryfire")
    FLAM A 0 bright A_GunFlash
    FLAM A 1 bright A_FireCustomMissile("FTFire", 0, 1, Random(-4, 4), 0)
    FLAM B 1 bright A_FireCustomMissile("FTFire", 0, 0, Random(-4, 4), 0)
    FLAM B 1 bright A_FireCustomMissile("FTFire", 0, 1, Random(-4, 4), 0)
    FLAM a 0 bright A_GunFlash
    FLAM a 1 bright A_FireCustomMissile("FTFire", 0, 1, Random(-4, 4), 0)
    FLAM b 1 bright A_FireCustomMissile("FTFire", 0, 0, Random(-4, 4), 0)
    FLAM b 1 bright A_FireCustomMissile("FTFire", 0, 1, Random(-4, 4), 0)
    FLAM a 0 bright A_GunFlash
    FLAM a 1 bright A_FireCustomMissile("FTFire", 0, 1, Random(-4, 4), 0)
    FLAM b 1 bright A_FireCustomMissile("FTFire", 0, 0, Random(-4, 4), 0)
    FLAM b 1 bright A_FireCustomMissile("FTFire", 0, 1, Random(-4, 4), 0)
    FLAM A 2 bright A_ReFire
    FLAM A 20 A_ReFire
    Goto Ready
	 Reload:
  FLAM A 0 A_JumpIfInventory("FlamethrowerLoaded", 150, 2)
  FLAM A 0 A_JumpIfInventory("Fuel", 1, "ReloadWork")
  FLAM A 0
  Goto Ready+2
 ReloadWork:
  FLAM A 1 Offset(0,35) A_PlayWeaponSound("FLAMERE1")
  FLAM A 1 Offset(0,38)
  FLAM A 1 Offset(0,44)
  FLAM A 1 Offset(0,52)
  FLAM A 1 Offset(0,52)
  FLAM A 1 Offset(0,44)
  FLAM A 1 Offset(0,38)
  FLAM A 15 Offset(0,35)
  FLAM A 1 Offset(0,38) A_PlayWeaponSound("FLAMERE2")
  FLAM A 1 Offset(0,44)
  FLAM A 1 Offset(0,52)
  FLAM A 1 Offset(0,56)
  FLAM A 1 Offset(0,60)
  FLAM A 5 Offset(0,68)
 ReloadLoop:
  TNT1 A 0 A_TakeInventory("Fuel", 1)
  TNT1 A 0 A_GiveInventory("FlamethrowerLoaded", 1)
  TNT1 A 0 A_JumpIfInventory("FlamethrowerLoaded", 150, "ReloadFinish")
  TNT1 A 0 A_JumpIfInventory("Fuel", 1, "ReloadLoop")
  Goto ReloadFinish 
 ReloadFinish: 
  FLAM A 40 Offset(0,68) A_PlayWeaponSound("FLAMERE3")
  FLAM A 1 Offset(0,60)
  FLAM A 1 Offset(0,56)
  FLAM A 1 Offset(0,52)
  FLAM A 1 Offset(0,44)
  FLAM A 1 Offset(0,38)
  FLAM A 1 Offset(0,35)
  FLAM A 1 Offset(0,32)
  Goto Ready
  Flash:
    TNT1 A 2 Bright A_Light1
    TNT1 A 2 Bright A_Light2
    TNT1 A 1 Bright A_Light1
    TNT1 A 1 Bright A_Light0
    stop
  Spawn:
    PLAS A -1
    Stop
  }
}

ACTOR fuel : Ammo replaces cell
{
  Game Doom
  Inventory.PickupMessage "Picked up a flame unit."
  Inventory.PickupSound "FLAMPICK"
  Inventory.Amount 20
  Inventory.MaxAmount 500
  Ammo.BackpackAmount 20
  Ammo.BackpackMaxAmount 999
  scale 0.2
  Inventory.Icon "FUELA0"
  States
  {
  Spawn:
    FUEL A -1
    Stop
  }
}

ACTOR canister : fuel replaces cellpack
{
  Game Doom
    scale 0.6
  Inventory.PickupMessage "Got a Fuel canister"
  Inventory.PickupSound "FLAMPICK"
  Inventory.Amount 100
  States
  {
  Spawn:
    FUEP A -1
    Stop
  }
}


actor flamespout
{
  Game Doom
  SpawnID 51
  Radius 13
  Height 8
  Speed 30
  Damage 2
  Projectile
  +RANDOMIZE
  RenderStyle Add
  Alpha 0.75
  DamageType Fire
  seesound "incinmid"
  Obituary "%o was melted by %k's flamethrower."
  States
  {
  Spawn:
    FRFX ABCDEFGHIJKLMNOP 1 bright
    stop
  Death:
    FRFX J 0 A_CustomMissile ("DropFire",0,0,0,4)  
    //FRFX JKLMNOP 2 bright
    stop
  }
}

Actor DropFire
{
  Radius 8
  Height 40
  Projectile
  RenderStyle Add
  DamageType Fire
  Alpha 0.90
  +PAINLESS
  -NoGravity
  +LowGravity
  +NoExplodeFloor
  +NoDamageThrust
  +BLOODLESSIMPACT
  States
  {
  Spawn:
    TNT1 A 0 A_PlaySound("fire1")
    FLME A 2 bright A_Explode(1, 32, 1)
    FLME BCDEFGHIJKLMN 2 bright A_Explode(2, 16, 1)
    TNT1 A 0 A_PlaySound("fire1")
    FLME A 2 bright A_Explode(1, 32, 1)
    FLME BCDEFGHIJKLMN 2 bright A_Explode(2, 16, 1)
    TNT1 A 0 A_PlaySound("fire1")
    FLME A 2 bright A_Explode(1, 32, 1)
    FLME BCDEFGHIJKLMN 2 bright A_Explode(2, 16, 1)
    TNT1 A 0 A_PlaySound("fire1")
    FLME A 2 bright A_Explode(1, 32, 1)
    FLME BCDEFGHIJKLMN 2 bright A_Explode(2, 16, 1)
    TNT1 A 0 A_PlaySound("fire1")
    FLME A 2 bright A_Explode(1, 32, 1)
    FLME BCDEFGHIJKLMN 2 bright A_Explode(2, 16, 1)
    TNT1 A 0 A_Jump(192, "Death")
    Loop
  Death:
    TNT1 A 1
    Stop
  }
}

Actor FTFire
{
  Radius 2
  Height 4
  Speed 16
  Damage 1
  Projectile
  RenderStyle Add
  DamageType Fire
  +BLOODLESSIMPACT
  Alpha 0.67
  Scale 0.67
  SeeSound "FMTRFIRE"
  DeathSound "FMTRHIT"
  States
  {
  Spawn:
    TNT1 A 2
    FRFX ABCD 2 bright A_Explode(2, 8, 0)
    TNT1 A 0 A_LowGravity
    FRFX EFG 2 bright A_Explode(2, 16, 0)
    FRFX HIJ 2 bright A_Explode(2, 32, 0)
    FRFX KLM 2 bright A_Explode(2, 64, 0)
    FRFX NO 2 bright
    Stop
  Death:
    FRFX HIJ 2 bright A_Explode(2, 32, 0)
    TNT1 A 0 A_CustomMissile("DropFire", 0, 0, 0, 4)
    FRFX KLM 2 bright A_Explode(2, 64, 0)
    FRFX NO 2 bright
    Stop
  }
}


ACTOR FlamethrowerLoaded : Ammo
{
Inventory.Icon "FLAMA0"
 Inventory.MaxAmount 150
 Inventory.Icon "FUELA0"
 +IGNORESKILL
}