ACTOR CrashPlasmaRifle : DoomWeapon
{
  Weapon.SelectionOrder 2500
  Weapon.AmmoUse 1
  Weapon.AmmoGive 70
  Weapon.AmmoType "cell"
  +WEAPON.NOAUTOFIRE
  Inventory.PickupMessage "Youve got the Plasma 'Heartless' Gun! The name will say my feeling!"
  Tag "UAC Heartless"
  Inventory.RestrictedTo "CrashClass"
      Weapon.BobRangeX 0.2
	Weapon.BobRangeY 0.2
  States
  {
  Ready:
    FLSG A 1 A_WeaponReady
    Loop
  Deselect:
    FLSG A 1 A_Lower
	TNT1 A 0 A_Lower
	TNT1 A 0 A_Lower
    Loop
  Select:
    FLSG A 1 A_Raise
	TNT1 A 0 A_Raise
	TNT1 A 0 A_Raise
    Loop
  Fire:
  TNT1 A 0 A_PLAYWEAPONSOUND("DSPLASM2")
  FLSG E 0 A_GUNFLASH
  FLSG E 2 BRIGHT OFFSET(0,34) A_FIRECUSTOMMISSILE("TESLASHOT")
  FLSG F 1 BRIGHT OFFSET(0,35)
  TNT1 A 0 A_PLAYWEAPONSOUND("DSPLASM2")
  FLSG G 0 A_GUNFLASH
  FLSG G 2 BRIGHT OFFSET(0,37) A_FIRECUSTOMMISSILE("TESLASHOT")
  FLSG H 1 BRIGHT OFFSET(0,34)
  TNT1 A 0 A_REFIRE
  FLSG ABCDDDDCBA 2
    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 TeslaShot
{
  Damage 12
  Projectile
  Speed 30
  SeeSound ""
  DeathSound "weapons/plasmax"
  RenderStyle Add
  alpha 0.5
  scale 0.9
  Decal none
  -EXTREMEDEATH
  VSpeed 2
  Mass 5
  States
  {
  Spawn: 
    MRS2 A 1 bright A_SpawnItemEx("TeslaExtra1",0,0,0,random(-4,4),random(-4,4),random(-4,4),random(1,360))
	TNT1 A 0 A_SpawnItem("TeslaTail")
	MRS2 B 1 bright A_SpawnItemEx("TeslaTail",0,0,0,random(-4,4),random(-4,4),random(-4,4),random(1,360))
	TNT1 A 0 A_SpawnItem("TeslaExtra1")
    Loop
	death:
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("TeslaExtra",0,0,0,random(-4,4),random(-4,4),random(-4,4),random(1,360))
	MRS2 CDEFG 2 bright
	Stop
  }
}

Actor TeslaExtra
{
	Projectile
	Damage 0
	+RIPPER
	+BLOODLESSIMPACT
	Speed 0
	Radius 1
	Height 1
	Scale 0.2
	RenderStyle Add
	States
	{
	Spawn:
		ZAPR ABC 1 Bright
		TNT1 A 0 A_Jump(160,1)
		Loop
		ZAPR ABC 1 Bright
		ZAPR DE 1 Bright A_FadeOut
		Wait
	Death:
		TNT1 A 1
		Stop
	}
}
Actor Teslatail
{
	Projectile
	Damage 0
	+RIPPER
	+BLOODLESSIMPACT
	+NOGRAVITY
	Speed 0
	Radius 1
	Height 1
	Scale 0.05
	RenderStyle Add
	States
	{
	Spawn:
		MRS2 AB 1 bright A_FadeOut
		wait
	}
}
Actor TeslaExtra1 : TeslaExtra
{
Scale 0.1
}