// --------------------------------------------------------------------------
//
// Taser (Demo weapon)
//
// --------------------------------------------------------------------------


//Weapon Auxiliar
ACTOR TaserPuff
{
	AttackSound "Taser/Hitwall"
        
        seesound "Taser/Hit"
        
	+NOGRAVITY
	+NOEXTREMEDEATH
	+PUFFONACTORS
	States
	{
	Spawn:
		TNT1 AAAAAAAAAA 0 A_CustomMissile("2704XplodExtra",0,0,random(0,359))
 TNT1 A 1 A_SpawnItem("NewPlasmaBallBOOM")
 TNT1 A 1
    TNT1 A 1 
		Stop
	Melee:
		TNT1 AAAAAAAAAA 0 A_CustomMissile("2704XplodExtra",0,0,random(0,359))
 TNT1 A 1 A_SpawnItem("NewPlasmaBallBOOM")
 TNT1 A 1
		Stop
	}
}



Actor 2704XplodExtra
{
PROJECTILE
+NOCLIP
-NOGRAVITY
+DONTSPLASH
  RenderStyle Add
  alpha 0.95
Height 4
Radius 4
Speed 3
Gravity 0.3
//Translation "168:191=192:207"
  Scale 0.05
States
{
Spawn:
	SPRK BB 0 A_Recoil(-5)
	SPRK BB 1 Bright ThrustThingZ(0,random(2,6),0,1)
	SPRK BBBBBBBBB 1 Bright
	SPRK B 1 Bright A_FadeOut
	Wait
}
}


//---------------------
ACTOR NewPlasmaBallBOOM
{
Radius 1
Height 1
RenderStyle Add
Alpha 0.25
Scale 0.5

+NOGRAVITY
+FORCEXYBILLBOARD
-SOLID
  
States
 {
 Spawn:
		TNT1 AAAAAAAAAA 0 A_CustomMissile("2704XplodExtra",0,0,random(0,359))
 NULL A 1
 NULL A 0 A_Jump(100,4)
 NULL A 0 A_Jump(90,5)
 NULL A 0 A_Jump(80,6)
 NULL A 0 A_Jump(70,7)
 PBEX A 6 BRIGHT
 Goto DeathA
 PBEX B 6 BRIGHT
 Goto DeathB
 PBEX C 6 BRIGHT
 Goto DeathC
 PBEX D 6 BRIGHT
 Goto DeathD
  
 DeathA:
 PBEX AAAAAA 1 BRIGHT A_FadeOut
 Stop

 DeathB:
 PBEX BBBBBB 1 BRIGHT A_FadeOut
 Stop

 DeathC:
 PBEX CCCCCC 1 BRIGHT A_FadeOut
 Stop
   
 DeathD:
 PBEX DDDDDD 1 BRIGHT A_FadeOut
 Stop     
 }
}





ACTOR "Taser" : CSDMOWeapon //5010
{
	Weapon.SisterWeapon taser_rat

	Weapon.SelectionOrder 700
	obituary "%k killed %o with Taser."
	  weapon.ammotype "TaserAmmo"
  weapon.ammouse 1
  weapon.ammogive 1
	+WEAPON.WIMPY_WEAPON
	+WEAPON.MELEEWEAPON
	+INVENTORY.UNDROPPABLE
	Inventory.Pickupmessage "Picked up a Taser!"
  inventory.pickupsound "misc/w_pkup"
	Tag "Taser"
	Weapon.UpSound "Taser/Ready"
	//AttackSound "Taser/Slash" 
	Scale 0.18

	States
	{

	NoShot:
	TNT1 A 0 A_Print("You already used your Taser ammo. Go find another!", 3)
		W37B J 1 A_WeaponReady
		Goto Ready

	Ready:
		W37B J 1 A_WeaponReady
		Loop



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

	Select:
	TNT1 A 1 A_Raise
	TNT1 AA 0 A_Raise
	TNT1 A 0 ACS_ExecuteAlways(798, 0, 240, 0, 0)//Weapon Weight
	TNT1 A 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")

		TNT1 A 11 A_WEAPONREADY(WRF_NOFIRE)
		W37A NOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W37B ABCDEFGHI 1 A_WEAPONREADY(WRF_NOFIRE)
		Goto Ready

	Rat_TriggerSelect:
    TNT1 A 0 A_TakeInventory("Rat_Trigger",1)
 
		TNT1 A 11 A_WEAPONREADY(WRF_NOFIRE)
		W37A NOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W37B ABCDEFGHI 1 A_WEAPONREADY//(WRF_NOFIRE)
		Goto Ready

	Fire:
		W37B J 1 A_JumpIfNoAmmo("NoShot")


TNT1 A 0 A_FireCustomMissile("WeaponSmokePuff2",0,0,11,4)
		TNT1 A 0 A_PlayWeaponSound("Taser/Fire")
		W37D A 1 A_CustomPunch(128, 0, 0, "TaserPuff", 192)//A_GunFlash
		TNT1 A 0 A_TakeInventory("TaserAmmo", 1)
		W37D BCDEFGHIJKLMNOPQR 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
		W37B J 1 A_JumpIfNoAmmo("PreviousWeapon")
		Goto Ready

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







	Flash:
		TNT1 A 0 //A_Light0
		TNT1 A 0 A_PlaySound("Taser/Slash")
		TNT1 A 2 //A_CustomPunch(64, 0, 0, "TaserPuff", 192)
		Goto LightDone



 	Spawn:
		W37Z A -1
		Stop
	}
}

