actor ShockGauntletWep_NormalBar : NormalBar { args 4, 216 }

actor ShockGauntletWep : BaseMM8BDMWep 
{
	//$Category MM8BDM-Weapons
	//$Title Shock Gauntlet
	Weapon.AmmoUse 2
	Weapon.AmmoGive 28
	Weapon.SlotNumber 4
	Inventory.Pickupmessage "$PU_SHOCKGAUNTLET"
	Obituary "$OB_SHOCKGAUNTLET"
	Tag "$TAG_SHOCKGAUNTLET"
	weapon.ammotype "ShockGauntletAmmo"
	inventory.icon "SHOGSI"
	States
	{
		SpawnLoop:
			SHCG A -1
			loop
			
		Ready:
			SHCG E 0 ACS_NamedExecuteWithResult("core_weaponcolor",CLR_SHOCKGAUNTLET)
			SHCG D 1 A_WeaponReady
			Goto Ready+1
			
		Deselect:
			SHCG D 0
			goto DeselectSwap
		Select:
			SHCG D 0
			goto SelectSwap
			
		Fire:
			SHCG D 0 A_JumpIfNoAmmo("NoAmmo")
			SHCG D 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
			SHCG D 0 A_FireCustomMissile("ShockGauntlet",0,1,8,0)
			SHCG EF 4
			SHCG D 15
			SHCG E 0 A_Refire
			Goto Ready+1

		NoAmmo:
			SHCG D 1 ACS_NamedExecuteAlways("core_noammo",0)
			Goto Ready+1
	}
}

actor ShockGauntletAmmo : Ammo
{
	inventory.amount 1
	inventory.maxamount 28
	+INVENTORY.IGNORESKILL
}

actor ShockGauntlet : BasicProjectile
{
	+RIPPER
	+NOTARGETSWITCH
	Radius 12
	Height 12
	speed 56
	damage (CallACS("mmrf_cbm_damage", 16))
	damagetype "ShockGauntlet"
	Obituary "$OB_SHOCKGAUNTLET"
	reactiontime 15
	States
	{
		Spawn:
			SHCG B 0
			SHCG B 0 A_SpawnItemEx("ThunderClawPegHelper")
			SHCG B 1 A_Countdown
			loop
		Death:
			SHCG B 0 A_CustomMissile("ReturningGauntlet",0,0,0,0)
			stop
	}
}

actor ReturningGauntlet : ShockGauntlet
{
	+PAINLESS
	damage (0)
	radius 0
	height 0
	speed 25
	reactiontime 1
	States
	{
		Spawn:
			SHCG C 0
			SHGC C 0 A_SetArg(0, 25)
		SpawnLoop:
			SHCG C 1 A_GiveInventory("ShockGauntletFunc", 1)
			loop
		Death:
			SHCG C 0
			stop
	}
}

actor ShockGauntletFunc : CustomInventory
{
    States
    {
		Pickup:
			TNT1 A 0 A_JumpIfCloser(32, "PickupD")
			TNT1 A 0 A_GiveInventory("HeadTowardsTarget_arg0",1)
			TNT1 A 0 ACS_NamedExecuteAlways("mmrf_shockgauntlet", 0, 140, 32, 80)
			stop
		PickupD:
			TNT1 A 0 A_CountDown
			stop
    }
}
