ACTOR LegendaryCoachgun : Weapon
{
  Scale 0.85
  +WEAPON.NOALERT
  +WEAPON.AMMO_OPTIONAL
  Weapon.SelectionOrder 400
  Weapon.PreferredSkin "DoubleBarrelSG-Marine"
  Decal LegBulletChip
  Weapon.KickBack 100
  Weapon.AmmoUse 0
  Weapon.AmmoGive 0
  Weapon.AmmoGive2 8
  Weapon.AmmoType "LegendaryCoachShells"
  Weapon.AmmoType2 "LegendaryShell"
  Inventory.PickupMessage "Legendary Coachgun!"
  Inventory.PickupSound "Coachgun/Pickup"
  Obituary "%o was surprised that an absolute madman went through the effort to make a CF deathmatch patch."
  Tag "Legendary Coachgun"
  States
  {
  Spawn:
	LSS0 Z -1 Bright
	Loop
  Ready:
	TNT1 A 0 A_PlayWeaponSound("Coachgun/Pickup")
	LSS7 ABCDEFGH 1
  ReadyLoop:
	LSSG A 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	Loop
  Select:
	TNT1 A 0 A_Raise
	Wait
  Deselect:
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	TNT1 A 0 A_TakeInventory("MineAction",1)
	TNT1 A 0 A_TakeInventory("RailgunAction",1)
  DeselectLoop:
	LSSG A 1 A_Lower
	Loop
  Fire:
	TNT1 A 0 A_JumpIfInventory("LegendaryCoachShells",2,"FireBoth")
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",1,"Reload")
	Goto Empty
  FireBoth:
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Light1
	TNT1 A 0 A_PlaySound("Coachgun/Fire1",1)
	TNT1 A 0 Radius_Quake(6,5,0,1,0)
	TNT1 A 0 A_TakeInventory("LegendaryCoachShells",2)
	TNT1 AAAAAAAA 0 A_FireCustomMissile("BlueSGTracer",Random(8,-8),0,0,Random(8,-8))
	TNT1 A 0 A_FireBullets(10,5,24,random(20,28),"LegendaryASGBulletPuff")
	TNT1 A 0 A_Light2
	LSSF AB 1 Bright Radius_Quake(6,5,0,1,0)
	LSSF CD 1
	TNT1 A 0 A_Light0
	LSSF EEFFGG 1
	TNT1 A 0 A_Light0
	LSSG AAA 1
  SSGReloadCheck:
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",2,2)
	LSSG A 2
	Goto ReadyLoop
	TNT1 A 0
	Goto ReloadBoth
  AltFire:
	TNT1 A 0 A_JumpIfInventory("LegendaryCoachShells",2,"FireRight")
	TNT1 A 0 A_JumpIfInventory("LegendaryCoachShells",1,1)
	Goto Reload
	TNT1 A 0 A_PlaySound("Coachgun/Fire2",1)
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Light1
	TNT1 A 0 Radius_Quake(4,4,0,1,0)
	TNT1 A 0 A_TakeInventory("LegendaryCoachShells",1)
	TNT1 AAAA 0 A_FireCustomMissile("BlueSGTracer",Random(6,-6),0,0,Random(6,-6))
	LSS9 G 1 Bright A_FireBullets(4,2,10,Random(20,28),"LegendaryASGBulletPuff")
	LSS9 H 1 Bright A_Light2
	TNT1 A 0 A_Light0
	LSS9 IDEF 1
	LSSG A 2
	Goto ReadyLoop
  FireRight:
	TNT1 A 0 A_PlaySound("Coachgun/Fire2",1)
	TNT1 A 0 A_AlertMonsters
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Light1
	TNT1 A 0 Radius_Quake(4,4,0,1,0)
	TNT1 A 0 A_TakeInventory("LegendaryCoachShells",1)
	TNT1 AAAA 0 A_FireCustomMissile("BlueSGTracer",Random(6,-6),0,0,Random(6,-6))
	LSS9 A 1 Bright A_FireBullets(4,2,10,Random(20,28),"LegendaryASGBulletPuff")
	LSS9 B 1 Bright A_Light2
	TNT1 A 0 A_Light0
	LSS9 CDEF 1
	LSSG A 2
	Goto ReadyLoop
  Empty:
	TNT1 A 0 A_JumpIfInventory("LegendaryCoachShells",1,"Empty2")
	LSSG A 10 A_PlaySound("weapons/click")
	Goto ReadyLoop
  Empty2:
	LSSG A 10 A_PlaySound("weapons/click")
	Goto ReadyLoop
  Reload:
	TNT1 A 0 A_JumpIfInventory("LegendaryCoachShells",1,"ReloadRight")	
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",2,"ReloadBoth")
	Goto Empty	
  ReloadBoth:
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",2,1)
	Goto ReadyLoop
	LSSG A 1
	LSSR BCDEFGHIJKLMNOP 1
	LSSR P 2 A_PlaySound("Coachgun/Open",7)
	TNT1 AA 0 A_SpawnItemEx("BlueShellCasing",25,-2,25,Random(2,4),Random(-3,-6),Random(3,6),0)
	LSS2 ABCDEFGHIJ 1
	TNT1 A 0 A_PlaySound("Coachgun/Load",7)
	TNT1 A 0 A_TakeInventory("LegendaryShell",2,TIF_NOTAKEINFINITE)
	TNT1 A 0 A_GiveInventory("LegendaryCoachShells",2)
	LSS2 KLMNO 1
	LSS3 ABCDEFGH 1
	LSS3 I 2 A_PlaySound("Coachgun/Close",7)
	LSS3 IJK 1
	LSSG A 2
	Goto ReadyLoop
  ReloadRight:
	TNT1 A 0 A_JumpIfInventory("LegendaryShell",1,1)
	Goto ReadyLoop
	LSSR BCDEFGNOP 1
	LSS3 P 1 A_PlaySound("Coachgun/Open",7)
	TNT1 A 0 A_SpawnItemEx("BlueShellCasing",25,-2,25,Random(2,4),Random(-3,-6),Random(3,6),0)
	LSS3 PQR 1
	LSSG UVWX 1
	TNT1 A 0 A_PlaySound("Coachgun/Load",7)
	TNT1 A 0 A_TakeInventory("LegendaryShell",1,TIF_NOTAKEINFINITE)
	TNT1 A 0 A_GiveInventory("LegendaryCoachShells",1)
	LSS2 KLMNO 1
	LSS3 ABCDEFGH 1
	LSS3 I 2 A_PlaySound("Coachgun/Close",7)
	LSS3 IJK 1
	LSSG A 2
	Goto ReadyLoop
  GrenadeCheck:
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,"GrenadeToss")
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	Goto ReadyLoop
  GrenadeToss:
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	LSS8 FEDCBA 1
	TNT1 A 4
	HGRN ABC 1
	HGRN D 2
	HGRN EFG 1
	HGRN HI 2
	TNT1 A 15 A_PlayWeaponSound("weapons/hgrenadepin")
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	TNT1 A 0 A_TakeInventory("HandGrenadeAmmo",1,TIF_NOTAKEINFINITE)
	HGNE A 1 A_FireCustomMissile("ThrownGrenade",0,0,0,0,false)
	HGRN J 1
	HGRN KLM 2
	HGRN NO 1
	TNT1 A 6
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,2)
	TNT1 A 0// A_TakeInventory("Hand Grenade",1)
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	TNT1 A 0
	LSS8 ABCDEF 1
	Goto ReadyLoop
  MineCheck:
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,"MineToss")
	TNT1 A 0 A_TakeInventory("MineAction",1)
	Goto ReadyLoop
  MineToss:
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	LSS8 FEDCBA 1
	TNT1 A 8
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	MINE ABCDEF 1	
	TNT1 A 0 A_TakeInventory("MineAmmo",1,TIF_NOTAKEINFINITE)	  
	MINE G 1 A_FireCustomMissile("ThrownMine",0,0,0,0,false)
	MINE HI 1
	MINE JK 2
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,2)
	TNT1 A 0// A_TakeInventory("Land Mine",1)
	TNT1 A 0 A_TakeInventory("MineAction",1)
	TNT1 A 0
	TNT1 A 5
	LSS8 ABCDEF 1
	Goto ReadyLoop
	}
}

ACTOR LegendaryCoachShells : Ammo
{
  +IGNORESKILL
  Inventory.Amount 0
  Inventory.MaxAmount 2
  Ammo.BackpackAmount 0
  Ammo.BackpackMaxAmount 2
  Inventory.Icon "LSS0Z0"
}