// --------------------------------------------------------------------------
//
// HE Grenade (Demo weapon "Appears on weapons training")
//
// --------------------------------------------------------------------------

ACTOR "HE_GRENADE" : CSDMOWeapon //5010
{
//	Weapon.SisterWeapon "HE Grenade_RAT"

	Weapon.SelectionOrder 1900
	Weapon.AmmoUse 1
	Weapon.AmmoGive 0
	Weapon.AmmoType "HEGRENADEAmmo"
	obituary "%k killed %o with HE Grenade."
	+WEAPON.WIMPY_WEAPON
	Inventory.Pickupmessage "Pickep up a HE Grenade."
	Tag "High Explosive Grenade"
	Weapon.UpSound "HEGRENADE/Ready"
	AttackSound "HEGRENADE/Fire" 
	Scale 0.2
	+weapon.CHEATNOTWEAPON
	 +IGNORESKILL
	 +WEAPON.EXPLOSIVE
	//+NOAUTOFIRE

	States
	{
	
	Deselect:
				TNT1 A 0 A_StopSound (6)
				TNT1 A 1 A_ZoomFactor(1.0)
		TNT1 A 0 ACS_Execute(783, 0, 0, 0, 0)
                TNT1 AAAAAAAAAAAAAAAAA 0 A_Lower
                TNT1 AAAAAA 1 A_Lower
		Loop	
	
	
	Ready:
//    TNT1 A 0 A_JumpIfInventory("RipAndTear_Powerup",1, "QuickFire")
		W16B J 1 A_WeaponReady
//TNT1 A 0 A_JumpIf((ACS_ExecuteWithResult(809,0,0,0)==1),"BobLoop")
		Loop
		

		
	Select:
	TNT1 A 1 A_Raise
	TNT1 AA 0 A_Raise
	TNT1 A 0 ACS_ExecuteAlways(798, 0, 245, 0, 0)//Weapon Weight
	TNT1 A 1 A_TakeInventory("CrosshairType",2)
    TNT1 A 0 A_JumpIfInventory("RipAndTear_Powerup",1, "QuickFire")
		Goto QuickFire




             SetWeapon:  
        TNT1 A 1 A_SelectWeapon("Knife")
        Goto Ready	






	QuickFire:
		TNT1 A 4 A_FireCustomMissile(HEGRENADEPROJECTILE,0,1,0,3,0,4)//A_GunFlash
		W16F EFGH 1 A_WEAPONREADY(WRF_NOFIRE|WRF_NOSWITCH)
		TNT1 A 4 A_WEAPONREADY(WRF_NOFIRE|WRF_NOSWITCH)
		Goto PreviousWeapon



	PreviousWeapon:
		TNT1 A 6 A_GiveInventory("Rat_Trigger",1)//A_PlaySound("HEGRENADE/Ready")
		TNT1 A 3 //A_PlaySound("HEGRENADE/Ready")
	TNT1 A 0 ACS_NamedExecuteAlways("HSPreviousWeapon", 0, 0, 0, 0)
Goto SetWeapon


             SetWeapon:  
        TNT1 A 1 A_WeaponReady(WRF_NOFIRE)//A_SelectWeapon("Knife")
        Goto Ready	




	Flash:
		TNT1 A 22 Bright //A_Light1
		TNT1 A 0 A_TakeInventory("HE_Grenade", 1)//A_AlertMonsters
//		TNT1 A 2 A_FireCustomMissile(HEGRENADEPROJECTILE,0,1,0,3,0,4)
		Goto LightDone
 	Spawn:
		W16Z A -1
		Stop







	}
}



