ACTOR CrashBFG9000 : DoomWeapon
{
  Weapon.SelectionOrder 2500
  Weapon.AmmoUse 2
  Weapon.AmmoGive 50
  Weapon.AmmoType "cell"
  +WEAPON.NOAUTOFIRE
  Inventory.PickupMessage "Youve got the Plasma 'Heartless' Gun! The name will say my feeling!"
  Tag "UAC Bio Force Gun Prototype"
  Inventory.RestrictedTo "CrashClass"
      Weapon.BobRangeX 0.2
	Weapon.BobRangeY 0.2
  States
  {
  Ready:
    BFG2 A 1 A_WeaponReady
    Loop
  Deselect:
     BFG2 A 1 A_Lower
	TNT1 A 0 A_Lower
	TNT1 A 0 A_Lower
    Loop
  Select:
     BFG2 A 1 A_Raise
	TNT1 A 0 A_Raise
	TNT1 A 0 A_Raise
    Loop
  Fire:
    TNT1 A 0 A_PLAYWEAPONSOUND("DSLAZST")
	BFG2 CDE 4 BRIGHT
	TNT1 A 0 A_PLAYWEAPONSOUND("DSLAZCN")
	BFG2 F 4 BRIGHT
	HOLD:
	TNT1 A 0 A_PLAYWEAPONSOUND("DSLAZLP")
	BFG2 G 0 A_GUNFLASH
	BFG2 G 2 Bright A_FireCustomMissile("ChannelerBeam", 0, 1, 0, 0)
	BFG2 H 0 A_GUNFLASH
	BFG2 H 2 Bright A_FireCustomMissile("ChannelerBeam", 0, 1, 0, 0)
	BFG2 I 0 A_GUNFLASH
	BFG2 I 2 Bright A_FireCustomMissile("ChannelerBeam", 0, 1, 0, 0)
	BFG2 J 0 A_GUNFLASH
	BFG2 J 2 Bright A_FireCustomMissile("ChannelerBeam", 0, 1, 0, 0)
	BFG2 K 0 A_GUNFLASH
	BFG2 K 2 Bright A_FireCustomMissile("ChannelerBeam", 0, 1, 0, 0)
	BFG2 L 0 A_GUNFLASH
	BFG2 L 2 Bright A_FireCustomMissile("ChannelerBeam", 0, 1, 0, 0)
	TNT1 A 0 A_REFIRE
	TNT1 A 0 A_PLAYWEAPONSOUND("DSBFGBL")
	TNT1 AAAAA 0 A_FireCustomMissile("ChannelerBeam", 0, 1, 0, 0)
	BFG2 M 2 BRIGHT OFFSET(0,35)
	BFG2 N 2 BRIGHT OFFSET(0,34)
	BFG2 O 2 BRIGHT OFFSET(0,33)
	BFG2 P 8 BRIGHT OFFSET(0,32)
    Goto Ready
	 	  ALTFire:
    HEXH A 12 A_PlayWeaponSound ("ForceBarrier/On")
	HEXH A 0 bright A_PlaySound ("ForceBarrier/Pew")
  ALTHold:
    HEXH A 1 bright A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    HEXH A 0 bright A_PlaySoundEx ("ForceBarrier/Loop", "SoundSlot5", 1)
    HEXH AAAAAAA 1 bright A_SpawnItemEx ("ShieldSpawner", 0, 96, 0, 0, 0, 0, -270, 32)
    HEXH A 0 bright 
    HEXH A 0 A_Refire
    HEXH A 0 A_StopSoundEx ("SoundSlot5")
    HEXH A 32 A_PlayWeaponSound ("ForceBarrier/Off")
    goto Ready
  Spawn:
    LAUN A -1
    Stop
  }
}

Actor ChannelerBeam : FastProjectile
{
  Speed 100
  Radius 13
  Height 8
  Damage 30
  Decal DoomImpScorch
  Renderstyle Add
  SeeSound ""
  Scale 0.55
  -CANNOTPUSH
  -NODAMAGETHRUST
  +NOEXTREMEDEATH
  MissileType "ChannelerTrailSpawner"
  states
  {
  Death:
    BBGB A 0 A_CustomMissile("ChannelerBeam2",0,0,random(0,360),4,random(0,360))
    BBGB ABCDE 2 bright
    stop
  }
}

ACTOR ChannelerBeam2 : ChannelerBeam
{
  states
  {
  Death:
    BBGB A 0 A_CustomMissile("ChannelerBeam3",0,0,random(0,360),4,random(0,360))
    BBGB ABCDE 2 bright
    stop
  }
}

ACTOR ChannelerBeam3 : ChannelerBeam
{
  states
  {
  Death:
    BBGB A 0 A_CustomMissile("ChannelerBeam4",0,0,random(0,360),4,random(0,360))
    BBGB ABCDE 2 bright
    stop
  }
}

ACTOR ChannelerBeam4 : ChannelerBeam
{
  states
  {
  Death:
    BBGB A 0
    BBGB ABCDE 2 bright
    stop
  }
}

ACTOR ChannelerSeducer : ChannelerBeam
{
  states
  {
  Death:
    BBGB A 0 A_CustomMissile("ChannelerSeductor",0,0,0,4,0)
    BBGB ABCDE 2 bright
    stop
  }
}

ACTOR ChannelerSeductor
{  
   Radius 0
   Height 0
   Scale 1
   +ISMONSTER
   +FRIENDLY
   +LOOKALLAROUND
   +NOBLOCKMONST
   +NOGRAVITY
   +NOINTERACTION
   Obituary "%o was burned by %k's volatile plasma."
   RenderStyle None
   States
   {
   Spawn:
     TNT1 A 0 A_Look
   See:
      TNT1 A 0 A_Chase
   Missile:
      TNT1 A 0 A_FaceTarget
      TNT1 A 1 A_CustomMissile("ChannelerBeam4",0,0,0)
      Stop
   }
}

ACTOR ChannelerTrailSpawner
{
  +NoGravity
  +NoClip
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1 A_SpawnItemEx ("ChannelerTrail", random (-3, 3), 0, random (-3, 3), 0, 0, 0, 0, 160)
    stop
  }
}

ACTOR ChannelerTrail
{
  Radius 2
  Height 2
  RenderStyle Add
  Scale 1
  +NOINTERACTION
  States
  {
  Spawn:
    BBGB AAAAAAAAAA 1 A_FadeOut
    stop
  }
}
