// --------------------------------------------------------------------------
//
// Healthshot (Weapon)
//
// --------------------------------------------------------------------------

ACTOR "Healthshot" : CSDMOWeapon //5010
{

//+AMMO_OPTIONAL

	Weapon.SelectionOrder 1900
  weapon.ammotype "HealthshotClip"
  weapon.ammouse 1
  weapon.ammogive 1
	obituary "%k killed %o with Healthshot."
	+WEAPON.WIMPY_WEAPON
	Inventory.Pickupmessage "Picked up a Healthshot."
	Tag "Healthshot"
	Weapon.UpSound "Healthshot/Ready"
  inventory.pickupsound "misc/w_pkup"
	//AttackSound "Healthshot/Fire"
	Scale 0.16

	States
	{
	NoShot:
	TNT1 A 0 A_Print("You already used your healthshot. Go find another!", 3)
		W49C A 1 A_WeaponReady
		Goto Ready

	Ready:
		W49C A 1 A_WeaponReady
		Loop



	Deselect:
TNT1 A 1 A_TakeInventory("Grenade_BlockMemo",1)
	TNT1 A 0 ACS_NamedExecuteAlways("HSPreviousWeapon", 0, 2, 0, 0)
    TNT1 A 0 
	Goto DeselectLoop

	Select:
	TNT1 A 1 A_Raise
	TNT1 AA 0 A_Raise
	TNT1 A 0 ACS_ExecuteAlways(798, 0, 245, 0, 0)//Weapon Weight
	W49A B 1 A_TakeInventory("CrosshairType",2)

	TNT1 A 0 ACS_NamedExecuteAlways("HSPreviousWeapon", 0, 1, 0, 0)
    TNT1 A 0 A_JumpIfInventory("RAT_Trigger",1,"RAT_TriggerSelect")

		W49A CDEFGHIJKLMNOPQR 1 A_WEAPONREADY(WRF_NOFIRE)
		W49A STUVWXYZ 1 A_WeaponReady
		W49B CDEFG 1 A_WEAPONREADY
		Goto Ready

	Rat_TriggerSelect:
    TNT1 A 0 A_TakeInventory("Rat_Trigger",1)

		W49A CDEFGHIJKLMNOPQR 1 A_WEAPONREADY(WRF_NOFIRE)
		W49A STUVWXYZ 1 A_WeaponReady
		W49B CDEFG 1 A_WEAPONREADY
		Goto Ready

	Fire:

TNT1 A 0 A_GiveInventory("Grenade_BlockMemo",1)

	W49E D 0 A_JumpIfNoAmmo("NoShot")
	
	
		TNT1 A 0 A_PlaySound ("Healthshot/FIRE")
		W49D ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W49D A 0 A_GunFlash

TNT1 A 0 A_TakeInventory("Grenade_BlockMemo",1)
		W49E ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W49F ABCDEFG 1 A_WeaponReady
//		TNT1 A 1 A_JumpIfNoAmmo("PreviousWeapon")
//		Goto Ready
	Goto PreviousWeapon




	PreviousWeapon:
		TNT1 A 2 //A_PlaySound("HEGRENADE/Ready")
	TNT1 A 0 ACS_NamedExecuteAlways("HSPreviousWeapon", 0, 0, 0, 0)
	TNT1 A 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 3 //A_PlaySound("HEGRENADE/Ready")
Goto Ready
	



	Flash:
	TNT1 A 0 ACS_ExecuteAlways(799, 0, 0, 0, 0)
	TNT1 A 0 A_GiveInventory("CrosshairGrow", 6)
//	TNT1 A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,16,1)
//		TNT1 A 0 Bright A_Light1
//		TNT1 A 0 A_AlertMonsters
TNT1 A 0 A_TakeInventory("HealthshotClip",1)
//		TNT1 A 0 A_PlaySound("Healthshot/Distant", 7)
tnt1 a 0 A_GiveInventory("HealthBonus", 50)

		Goto LightDone
 	Spawn:
		W49Z A -1
		Stop
	}
}