ACTOR SurvivalistFragGrenades : Weapon 
{
	//$Category Weapons
	//$Title "Frag Grenade"
	Tag "Grenades"
	Weapon.SelectionOrder 2600
	Inventory.PickupSound "Misc/W_PkUp"
	Inventory.PickupMessage "Picked up a Frag Grenade." 
	Scale 0.7
	Weapon.AmmoType1 "SurvGrenadeAmmo"
	Weapon.AmmoType2 "SurvGrenadeAmmo"
	Weapon.AmmoUse1 1
	Weapon.AmmoUse2 1
	Weapon.AmmoGive 1 //Not picked up if Dropped by enemy (See Ammo Decorates below)
	Weapon.Kickback 150
	+INVENTORY.IGNORESKILL
	+Weapon.Explosive
	+NOAUTOAIM //Off as AUTOAIM restricts the boundries the Grenades, they fly farther if you tilt upward but AutoAim will restrict that.
	+NOALERT
	Inventory.RestrictedTo "SurvivalistClass"
	States 
	{
	Spawn:
		GNA1 A -1
		Stop
	Select:
		D3GR A 1 A_Raise 
		TNT1 A 0 A_Raise
		TNT1 A 0 A_Raise
		Loop
	Deselect:
		TNT1 A 0 A_JumpIfInventory("SurvGrenadeAmmo",1,2)
		TNT1 A 1 A_Lower //Deselect With No Ammo
		TNT1 A 0 A_Lower
		Loop 
		D3GR A 1 A_Lower //Deselect With Ammo
		TNT1 A 0 A_Lower
		TNT1 A 0 A_Lower
		Loop
	Ready:
		D3GR A 1 A_WeaponReady
		Loop 
	Fire:
		TNT1 A 0 A_CheckReload
		D3GR A 1 Fast A_PlaySoundEx("FragGrenade/Pin",7)
		D3GR BCDEFGHIJKLMNOP 1 Fast
	SpeedUp: //Increase Projectile Speed. Resulting in larger distance covered & higher bounces on impact.
		D3GR Q 3
		TNT1 A 0 A_GiveInventory("GrenSpeed",1)
		D3GR Q 3 A_Refire("SpeedUp")
		HGT2 A 1 A_PlaySound("FragGrenade/throw")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",12,"Throw12")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",11,"Throw11")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",10,"Throw10")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",9,"Throw9")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",8,"Throw8")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",7,"Throw7")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",6,"Throw6")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",5,"Throw5")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",4,"Throw4")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",3,"Throw3")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",2,"Throw2")
		TNT1 A 0 A_JumpIfInventory("GrenSpeed",1,"Throw1")
	Throw1:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked01",0,1,0,0)
		Goto FireEnd
	Throw2:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked02",0,1,0,0)
		Goto FireEnd
	Throw3:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked03",0,1,0,0)
		Goto FireEnd
	Throw4:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked04",0,1,0,0)
		Goto FireEnd
	Throw5:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked05",0,1,0,0)
		Goto FireEnd
	Throw6:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked06",0,1,0,0)
		Goto FireEnd
	Throw7:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked07",0,1,0,0)
		Goto FireEnd
	Throw8:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked08",0,1,0,0)
		Goto FireEnd
	Throw9:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked09",0,1,0,0)
		Goto FireEnd
	Throw10:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked10",0,1,0,0)
		Goto FireEnd
	Throw11:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked11",0,1,0,0)
		Goto FireEnd
	Throw12:
		HGT2 B 1 A_FireCustomMissile("D3GrenadeCooked12",0,1,0,0)
		Goto FireEnd
	AltFire: //Throw a grenade instantly, distance depends on Player's pitch.
		TNT1 A 0 A_CheckReload
		D3GR A 1 Fast A_PlaySound("FragGrenade/Pin")
		D3GR BCDEFGHIJKLMNOP 1 Fast
		D3GR Q 3
		HGT2 A 1 A_PlaySound("FragGrenade/throw")
		HGT2 B 1 A_FireCustomMissile("D3Grenade2",0,1,0,0)
	FireEnd:
		TNT1 A 0 A_TakeInventory("GrenSpeed",999) //Resets the Charge distance
		HGT2 CDEF 2
		HGT2 GHIJ 2
		TNT1 A 0 A_CheckReload
		HGT2 J 3 Fast A_Lower
		TNT1 A 10
		D3GR A 3 Fast A_Raise
		Goto Ready
	
	}
}

ACTOR D3Grenade1 //Offers various speeds, longer bounce time & overall better accuracy
{	
	Speed 8 //Default Speed. Fast enough to roll the grenade, so it won't blow up underneath the player.
	Height 2
	Radius 12
	Mass 9
	Damage 10
	Scale 0.6
	BounceType "Doom" //actor bounces off planes and walls.
	BounceSound "FragGrenade/Bounce"
	WallBounceSound "FragGrenade/Bounce"
	PROJECTILE
	-NOGRAVITY
	+CANBOUNCEWATER
	+FORCERADIUSDMG
	BounceFactor 0.8
	WallBounceFactor 0.5
	BounceCount 6
	ReactionTime 9 //About 3 Seconds
	RenderStyle NORMAL
	DeathSound "FragGrenade/Explode"
	Decal RevenantScorch
	SelfObituary "%o threw %p frag a little too close to the demons."
	States
	{
	Spawn:
		HGN1 A 4 A_Countdown
		HGN1 BCDEF 4
		Loop
	Death:
		TNT1 A 0 A_SetScale(1,1)
		TNT1 A 0 A_ChangeFlag("NoGravity",1)
		EXP3 A 1 BRIGHT A_AlertMonsters
		EXP3 B 1 BRIGHT A_Explode(250,250)
		EXP3 CDEFGHIJKLMNOPQRSTUVWXYZ 1 BRIGHT
		STOP
	}
}
ACTOR D3GrenadeCooked01 : D3Grenade1 { Speed 8 } //Default
ACTOR D3GrenadeCooked02 : D3Grenade1 { Speed 10 }
ACTOR D3GrenadeCooked03 : D3Grenade1 { Speed 12 }
ACTOR D3GrenadeCooked04 : D3Grenade1 { Speed 14 }
ACTOR D3GrenadeCooked05 : D3Grenade1 { Speed 16 }
ACTOR D3GrenadeCooked06 : D3Grenade1 { Speed 18 }
ACTOR D3GrenadeCooked07 : D3Grenade1 { Speed 20 }
ACTOR D3GrenadeCooked08 : D3Grenade1 { Speed 22 }
ACTOR D3GrenadeCooked09 : D3Grenade1 { Speed 24 }
ACTOR D3GrenadeCooked10 : D3Grenade1 { Speed 26 }
ACTOR D3GrenadeCooked11 : D3Grenade1 { Speed 28 }
ACTOR D3GrenadeCooked12 : D3Grenade1 { Speed 30 }
//THROW SPEED
ACTOR GrenSpeed : Inventory { Inventory.MaxAmount 12 }

//Alternative Fire
ACTOR D3Grenade2 : D3Grenade1	//Throw a Grenade at full speed that won't bounce as much.
{	
	Speed 30
	BounceCount 3
}

Actor SurvGrenadeAmmo : Ammo	// use this instead of the weapon as DropItem
{
	//$Category Ammunition
	//$Title "Frag Grenade"
	Inventory.Amount 1
	Inventory.MaxAmount 20
	ammo.backpackamount 1
	ammo.backpackmaxamount 40
	+INVENTORY.IGNORESKILL
	Inventory.PickupMessage "you shouldn't ever see this message because this item will be replaced by the actual weapon"
	States
	{
	Spawn:
		TNT1 A 0
		Stop
	}
}