//==============================================================================
// Elektroshocker (Shoutouts to Term667 and Blade of Agony team)
//==============================================================================

ACTOR HDChainsaw : KriegslandLightWeapon
{
	+WEAPON.NOAUTOFIRE
	+INVENTORY.UNDROPPABLE
	Weapon.SelectionOrder 100
	Weapon.AmmoUse 1
	Weapon.SlotNumber 1
	Weapon.Kickback 0
	Weapon.AmmoGive 30
	Weapon.AmmoType "BOBT1"
	Inventory.Pickupmessage "You got the Elektroshocker!"
	Inventory.PickupSound 	"weapons/generic/pickup1"
	Tag "Elektroshocker"
	Scale 0.75
	States
	{
	Deselect:
		TNT1 A 0 A_StopSound(6)
		TNT1 A 0 A_StopSound(7)
		WPGG A 1 Offset(2, 34)
		WPGG A 1 Offset(7, 39)
		WPGG A 1 Offset(10, 47)
		WPGG A 1 Offset(22, 58)
		WPGG A 1 Offset(32, 69)
		WPGG A 1 Offset(54, 81)
		WPGG A 1 Offset(67, 100)
		WPGG A 1 A_Lower
		Wait 
	Ready:
		TNT1 A 0 A_PlaySound("weapons/ESK/idle",6,1,1)
		WPGG A 1 A_WeaponReady
		TNT1 A 0 A_JumpifInventory("IsBombing",1,"ThrowGrenade")
		NULL A 0 A_JumpIfInventory("SlidePlayer",1,"IsSliding")
		TNT1 A 0 A_JumpifInventory("IsKicking",1,"Kick")
		TNT1 A 0 A_JumpifInventory("IsKnifing",1,"Knife")
		Loop
	Select:
		TNT1 A 0 A_Playsound("weapons/generic/select2",7)
		WPGG A 1 Offset(67, 100)
		WPGG A 1 Offset(54, 81)
		WPGG A 1 Offset(32, 69)
		WPGG A 1 Offset(22, 58)
		WPGG A 1 Offset(10, 47)
		WPGG A 1 Offset(7, 39)
		WPGG A 1 Offset(2, 34)
		WPGG A 1 A_Raise
		Wait
	Fire:	
		TNT1 A 0 A_JumpIfInventory("BOBT1",1,1)
		Goto Dryfire
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG B 1 Offset(-1,32) A_StopSound(7)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG B 1 Offset(-2,30) A_StopSound(7)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG C 1 Offset(-3,29) A_StopSound(7)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG C 1 Offset(-4,28) A_StopSound(7)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG D 1 Offset(-5,27) A_StopSound(7)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG D 1 Offset(-6,26) A_StopSound(7)
	ActualShock:
		TNT1 A 0 A_JumpIfInventory("BOBT1",1,1)
		Goto Dryfire
		TNT1 A 0 A_Playsound("weapons/ESK/fire")
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_Gunflash
		TNT1 A 0 A_Saw("none","none",2,"ShockPuff")
		TNT1 A 0 A_TakeInventory("BOBT1",1)
		TNT1 A 0 A_Gunflash
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGF A 1 BRIGHT Offset(-8,25)
		TNT1 A 0 A_Playsound("weapons/ESK/fire")
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGF B 1 BRIGHT Offset(-7,26)
		TNT1 A 0 A_Playsound("weapons/ESK/fire")
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGF C 1 BRIGHT Offset(-6,24)
		TNT1 A 0 A_Playsound("weapons/ESK/fire")
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGF D 1 BRIGHT Offset(-5,25)
		TNT1 A 0 A_Playsound("weapons/ESK/fire")
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGF B 1 BRIGHT Offset(-6,27)
		TNT1 A 0 A_Playsound("weapons/ESK/fire")
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGF C 1 BRIGHT Offset(-7,26)
		TNT1 A 0 A_Playsound("weapons/ESK/fire")
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		TNT1 A 0 A_ReFire("ActualShock")
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG D 1 Offset(-6,26) A_StopSound(7)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG D 1 Offset(-5,27) A_StopSound(7)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG C 1 Offset(-4,28) A_StopSound(7)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG C 1 Offset(-3,29) A_StopSound(7)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG B 1 Offset(-2,32) A_StopSound(7)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		WPGG B 1 Offset(0,33) A_StopSound(7)
		Goto Ready
	Dryfire:
		TNT1 A 0 A_Print("No ammo",1)
		Goto Ready
	Kick:
		WPGT AB 1
		TNT1 A 1
		KICF A 1 Offset(-10,32)
		KICF CE 1
		KICF FG 1 A_Recoil(-1)
		TNT1 A 0 A_Jump(128,2)
		TNT1 A 0 A_PlaySound("FKPlayer/Grunt")
		KICF H 5 A_CustomPunch(6,0,0,"FightPuff") 
		KICF IGFEDC 1 
		KICF BA 1 A_Recoil(+0.5)
		TNT1 A 1
		WPGT BA 1
		Goto Ready
	IsSliding:
		TNT1 A 0 A_TakeInventory("SlidePlayer",1)
		TNT1 A 0 A_JumpIfInventory("CrouchPlayer",1,"Ready")
		WPGT AB 1
		TNT1 A 2 Offset(-10,36)
		TNT1 A 0 A_PlaySound("FKPlayer/slide/start",4)
		TNT1 A 0 A_PlaySound("FKPlayer/slide/loop",5,0.5,TRUE)
		TNT1 A 0 A_SetPitch(pitch+0.8)
		SLDK ABCDEF 2
		TNT1 A 0 A_SetPitch(pitch-0.8)
		SLDK G 6 A_FireCustomMissile("KickAttack",0,0,0,0)
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_PlaySound("FKPlayer/slide/end",6)
		SLDK HI 2
		Goto Ready
	Knife:
		WPGT AB 1
		NULL A 0 Offset(-10,32)
		NULL A 1
		WP1L AB 1
		NULL A 0 A_Jump(86,2)
		NULL A 0 A_PlaySound("FKPlayer/Grunt")
		WP1L C 1 A_CustomPunch(8,0,0,"KnifePuff")
		WP1L DEF 1
		NULL A 1
		WPGT BA 1
		Goto Ready
	Throwgrenade:
		TNT1 A 0 A_JumpIf(waterlevel>2,"Dryfire")
		TNT1 A 0 A_JumpIfInventory("BOGR1",1,1)
		Goto Dryfire
		WPGT AB 1
		TNT1 A 0 A_StopSound(1)
		TNT1 A 1 Offset(-20,32)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 A 1 Offset(0,28)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 B 1 Offset(0,24)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 C 1 Offset(0,23)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 D 1 Offset(0,26) A_PlaySound("weapons/SHG/throw")
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 D 1 Offset(0,28)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		TNT1 A 0 A_SpawnItemEx("RealGrenade",0,1,24,cos(pitch)*40,0,sin(-pitch)*40,3,SXF_TRANSFERPITCH|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_TakeInventory("BOGR1",1)
		MND2 E 1 Offset(-3,30)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 E 1 Offset(-6,31)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 F 1 Offset(-9,32)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		MND2 F 1 Offset(-12,33)
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSecondary|WRF_NoSwitch)
		TNT1 A 0 A_TakeInventory("GetOnWithIt", 100)
		TNT1 A 0 A_JumpIfNoAmmo("Dryfire")
		TNT1 A 7 Offset (75, 152)
		TNT1 A 1 Offset (5, 40)
		Goto Ready
	Flash:
		TNT1 A 2 Bright A_Light1
		Goto LightDone
		TNT1 A 2 Bright A_Light1
		Goto LightDone
 	Spawn:
		WPGP A -1
		Stop
	}
}