// Grenade Launcher (Skulltag / Quake)

ACTOR IDMGrenadeLauncher : IDMWeapon
{
	Radius 20
	Height 16
	Weapon.Selectionorder 400
	//Weapon.PreferredSkin "GrenadeMarine"
	+WEAPON.EXPLOSIVE
	+WEAPON.NOAUTOAIM
	Weapon.AmmoUse 1
	Weapon.AmmoGive 6
	Weapon.AmmoType "IDMRocketAmmo"
	Inventory.PickupSound "misc/w_pkup"
	Inventory.PickupMessage "Grenade Launcher! (Slot 5)"
	Tag "Grenade Launcher"
	+WEAPON.NOLMS
	States
	{
	Spawn:
	  GLAU A -1 Bright
	  Stop
	Ready:
	  GRLG A 1 A_WeaponReady
	  Loop
	Deselect:
	  TNT1 A 0 A_Lower
	  TNT1 A 0 A_Lower
	  GRLG A 1 A_Lower
	  Loop
	Select:
	  TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
	Sloop:
	  TNT1 A 0 A_Raise
	  TNT1 A 0 A_Raise
	  GRLG A 1 A_Raise
	  Loop
	Fire:
 	  TNT1 A 0 A_GunFlash
	  TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2",1,"Level2")
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
	Normal:
	  GRLG A 2 A_FireCustomMissile("IDMGrenade", 0, 1, 0, 0, 0, 4.5)
	  GRLG A 2 Offset(0,46)
	  GRLG A 2 Offset(0,44)
	  GRLG A 2 Offset(0,42)
	  GRLG A 2 Offset(0,40)
	  GRLG A 2 Offset(0,38)
	  GRLG A 2 Offset(0,36)
	  GRLG A 2 Offset(0,34)
	  GRLG A 2 Offset(0,33)
	  Goto FireEnd
	Level2:
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"QuadLevel2")
	  GRLG A 2 A_FireCustomMissile("MushroomGrenade", 0, 1, 0, 0, 0, 4.5)
	  GRLG A 10 Offset(0,48)
	  GRLG A 2 Offset(0,45)
	  GRLG A 2 Offset(0,42)
	  GRLG A 2 Offset(0,40)
	  GRLG A 2 Offset(0,38)
	  GRLG A 2 Offset(0,36)
	  GRLG A 2 Offset(0,34)
	  GRLG A 2 Offset(0,33)
	  Goto FireEnd
	Quad:
	  TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO,1)
	  GRLG A 2 A_FireCustomMissile("ExtremeGrenade", 0, 1, 0, 0, 0, 4.5)
	  GRLG A 2 Offset(0,46)
	  GRLG A 2 Offset(0,44)
	  GRLG A 2 Offset(0,42)
	  GRLG A 2 Offset(0,40)
	  GRLG A 2 Offset(0,38)
	  GRLG A 2 Offset(0,36)
	  GRLG A 2 Offset(0,34)
	  GRLG A 2 Offset(0,33)
	  Goto FireEnd
	QuadLevel2:
	  TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO,1)
	  GRLG A 2 A_FireCustomMissile("ExtremeMushroomGrenade", 0, 1, 0, 0, 0, 4.5)
	  GRLG A 10 Offset(0,48)
	  GRLG A 2 Offset(0,45)
	  GRLG A 2 Offset(0,42)
	  GRLG A 2 Offset(0,40)
	  GRLG A 2 Offset(0,38)
	  GRLG A 2 Offset(0,36)
	  GRLG A 2 Offset(0,34)
	  GRLG A 2 Offset(0,33)
	FireEnd:
	  GRLG A 4
	  TNT1 A 0 A_ReFire
	  Goto Ready 
	Flash: 
	  GRLF A 2 bright A_Light1
	  GRLF B 2 bright
	  GRLF C 3 bright A_Light2
	  GRLF D 3 bright A_Light2
	  Goto LightDone
	}
}

// Grenade Launcher's Grenade

ACTOR IDMGrenade
{
	Radius 10
	Height 10
	Speed 32
	Damage (100 + (20 * random(1,5)))
	Projectile
	ProjectileKickback 300
	-NOGRAVITY
	-NOTELEPORT
	+RANDOMIZE
	+DEHEXPLOSION
	+GRENADETRAIL
	+SKYEXPLODE
	+BOUNCEAUTOOFFFLOORONLY
	-BOUNCEONACTORS
	+ALLOWBOUNCEONACTORS
	BounceType "Hexen"
	Gravity 0.30
	SeeSound "weapons/grenlf"
	DeathSound "weapons/grenlx"
	BounceSound "weapons/grbnce"
	Obituary "%o tripped %k's grenade."
	SelfObituary "%o tripped %p own grenade."
	DamageType "Grenade"
	States
	{
	Spawn:
      SGRN A 70 Bright
	  SGRN A 0 A_ScaleVelocity(0)
	  SGRN A 0 A_ChangeFlag(NOGRAVITY,true)
	  MISL B 0 A_Scream
      MISL B 6 Bright A_Explode(128,128)
      MISL C 5 Bright
      MISL D 4 Bright
      Stop
	XDeath:
	Death:
	Death.Sky:
	Crash:
	  TNT1 A 0
	  SGRN A 0 A_ScaleVelocity(0)
	  SGRN A 0 A_ChangeFlag(NOGRAVITY,true)
	  MISL B 0 A_Scream
      MISL B 6 Bright A_Explode(128,128)
      MISL C 5 Bright
      MISL D 4 Bright
      Stop
	}
}

ACTOR ExtremeGrenade : IDMGrenade
{
	+EXTREMEDEATH
	ProjectileKickBack 400
	States
	{
	XDeath:
	  TNT1 A 0 A_Playsound("misc/crit",CHAN_AUTO)
	  Goto Death
	}
}


ACTOR IDMGrenadeMushroom : IDMMushroom
{
	DamageType "Grenade"
}

ACTOR ExtremeGrenadeMushroom : IDMGrenadeMushroom
{
	+EXTREMEDEATH
	States
	{
	XDeath:
	  TNT1 A 0 A_Playsound("misc/crit",CHAN_AUTO)
	  Goto Death
	}
}

ACTOR MushroomGrenade : IDMGrenade
{
	Radius 15
	Height 15
	Damage (100 + (30 * random(1,10)))
	DamageType "Grenade"
	SeeSound "weapons/grenlf2"
	BounceSound "weapons/grbnce2"
	Scale 1.5
	States
	{
	Spawn:
      SHGR A 70 Bright
	  SHGR A 0 A_ScaleVelocity(0)
	  SHGR A 0 A_ChangeFlag(NOGRAVITY,true)
	  MISL B 0 A_Scream
	  TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile("IDMGrenadeMushroom",8,0,random(-180,180),CMF_AIMDIRECTION|CMF_TRACKOWNER,random(0,75))
      MISL B 6 Bright A_Explode(192,192)
      MISL C 5 Bright
	  MISL D 4 Bright
	  Stop
	Crash:
	Death.Sky:
	XDeath:
    Death:
	  MISL B 0 A_Scream
	  TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile("IDMGrenadeMushroom",8,0,random(-180,180),CMF_AIMDIRECTION|CMF_TRACKOWNER,random(0,75))
      MISL B 6 Bright A_Explode(192,192)
      MISL C 5 Bright
	  MISL D 4 Bright
	  Stop
	}
}

ACTOR ExtremeMushroomGrenade : MushroomGrenade
{
	+EXTREMEDEATH
	States
	{
	XDeath:
	  TNT1 A 0 A_Playsound("misc/crit",CHAN_AUTO)
    Death:
      MISL B 0 A_Scream
	  TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile("ExtremeGrenadeMushroom",8,0,random(-180,180),CMF_AIMDIRECTION|CMF_TRACKOWNER,random(0,75))
      MISL C 5 Bright
	  MISL D 4 Bright
	  Stop
	}
}