//==================================
// PlasmaBallista
//==================================

Actor PlasmaBallista : Weapon
{
  Weapon.AmmoType "NewCell"
  Weapon.AmmoUse 1
  Weapon.AmmoGive 27
  Weapon.PreferredSkin "DTBallista-Marine"
  Weapon.UpSound "weapons/plasmaballup"
  Inventory.PickupMessage "You got the Plasma Ballista!"
  Obituary "%o was picked off by %k's plasma ballista"
  States
  {
  Spawn:
    WBOW A -1
    Stop
  Deselect:
    BSTA A 1 A_Lower
    Wait
  Select:
    BSTA A 1 Bright A_Raise
    Wait
  Ready:
    BSTA AAABBBCCCDDDBBB 1 Bright A_WeaponReady
    Loop
  Fire:
    BSTA E 0 A_GunFlash
    BSTA E 0 A_Recoil(3.0)
    BSTA E 0 A_PlaySound("Weapons/BallistaShot")
    BSTA E 0 A_PlaySound("Weapons/BallistaFire", CHAN_WEAPON)
    BSTA E 2 Bright A_FireCustomMissile("BallistaShot",0,1)
    BSTA FGH 2 Bright
    BSTA I 8
    BSTA I 2
    BSTA I 2 Offset(0,31) 
    BSTA J 2 Offset(0,32)
    BSTA J 2 Offset(0,30)
    BSTA K 2 Offset(0,31)
    BSTA K 2 Offset(0,30)
	BSTA K 3 Offset(0,31) A_PlaySound("Weapons/BallistaReload")
	BSTA K 6 Offset(0,32)
    BSTA L 1 Bright Offset(0,32)
    BSTA M 1 Bright
	BSTA A 3 Bright
    Goto Ready
  Flash:
    TNT1 A 2 Bright A_Light1
    TNT1 A 2 Bright A_Light2
    TNT1 A 1 Bright A_Light1
    Goto LightDone
  }
}

Actor BallistaShot : FastProjectile
{
  Radius 4
  Height 8
  Speed 160
  Damage 55
  Projectile
  RenderStyle Add
  Alpha 0.9
  Scale 0.8
  +RIPPER
  +MTHRUSPECIES
  +ForceRadiusDmg
  +NoDamageThrust
  +ForceXYBillboard
  Damagetype "Marine"
  DeathSound "Weapons/BallistaHit"
  MissileType "BallistaTrail"
  MissileHeight 8
  Decal "PlasmaScorchLower"
  States
  {
  Spawn:
    SSHT A 0 Bright
    SSHT A 1 Bright A_PlaySound("Weapons/BallistaFlyby", CHAN_BODY, 1.0, 1)
    Loop
  Death:    
    XXPL A 0 Bright A_StopSound(CHAN_BODY)
    XXPL A 0 Bright A_ChangeFlag("NODAMAGETHRUST", 0)
    XXPL A 0 Bright A_Explode(Random(150, 180), 36, 0)
    XXPL ABCDEFGH 1 Bright
    XXPL IJKLM 1 Bright A_FadeOut(0.1)
    Stop
  }
}

Actor BallistaTrail
{
  +ForceXYBillBoard
  +NoInteraction
  Radius 4
  Height 8
  Renderstyle Add
  Alpha 0.5
  States
  {
  Spawn:
    SSHT AABBCDEFG 1 Bright
    Stop
  }
}
