actor NecromancerCoachgun : Weapon
{
  Weapon.SelectionOrder 1300
  Weapon.AmmoUse 2
  Weapon.AmmoGive 4
  Weapon.AmmoType "Shell"
  Decal "BulletChip"
  Inventory.PickupMessage "You got the coach gun!"
  Obituary "%o was blown away by %k's coachgun."
  Tag "Coachgun"
  Inventory.RestrictedTo "NecromancerClass"

  States
  {
  Ready:
    COCH A 1 A_WeaponReady
    Loop

  Deselect:
    COCH A 1 A_Lower
    TNT1 A 0 A_Lower
    TNT1 A 0 A_Lower
    Loop

  Select:
    COCH A 1 A_Raise
    TNT1 A 0 A_Raise
    TNT1 A 0 A_Raise
    Loop

  Fire:
    COCH A 3
    COCH B 1 bright A_FireBullets(3, 2, 30, 12, "BulletPuff", FBF_USEAMMO|FBF_USEAMMO)
    COCH B 0 bright A_PlaySoundEx("coachgun/fire", "soundslot5")
    COCH B 0 bright A_Gunflash
    COCH B 0 bright A_Quake(3, 2, 0, 1)
    COCH C 1 bright A_SetPitch(pitch - 2)
    COCH D 1 A_SetPitch(pitch + 0.4)
    COCH AAAA 2 A_SetPitch(pitch + 0.4)
    COCH A 4
    COCH EFG 2
    COCH H 2 A_PlaySound("coachgun/reload1")
    COCH I 2
    COCH J 12
    COCH KLMNO 1
    COCH P 4 A_PlaySound("coachgun/reload2")
    COCH QRSTU 1
    COCH V 8
    COCH W 2
    COCH X 2 A_PlaySound("coachgun/reload3")
    COCH GFE 2
    COCH A 7 A_Refire
    Goto Ready

AltFire:
    // Make sure the player has enough shells for the megablast
    TNT1 A 0 A_JumpIfInventory("Shell", 10, 1)
    Goto Ready

    // Consume the shells (we'll take 10 at once)
    TNT1 A 0 A_TakeInventory("Shell", 10)

    // Firing frames
    COCH B 3 bright A_PlaySound("coachgun/megablast", CHAN_WEAPON)
    COCH B 0 bright A_FireBullets(10, 10, 150, 12, "BulletPuff", FBF_USEAMMO|FBF_USEAMMO) // massive spread, 150 pellet
    COCH B 0 bright A_GunFlash
    COCH B 0 bright A_Quake(6, 8, 0, 24) // screen quake
    COCH B 0 A_Recoil(20) // huge pushback recoil

    // Camera pitch kick
    COCH C 2 A_SetPitch(pitch - 10) // snap back hard
    COCH D 30 A_SetPitch(pitch + 1.0)

    // Recovery frames
    COCH EFG 2
    COCH H 2 A_PlaySound("coachgun/reload1")
    COCH I 2
    COCH J 12
    COCH KLMNO 1
    COCH P 4 A_PlaySound("coachgun/reload2")
    COCH QRSTU 1
    COCH V 8
    COCH W 2
    COCH X 2 A_PlaySound("coachgun/reload3")
    COCH GFE 2
    COCH A 7
    Goto Ready
  Flash:
    TNT1 A 4 Bright A_Light1
    TNT1 A 3 Bright A_Light2
    Goto LightDone

  Spawn:
    COCP A -1
    Stop
  }
}