actor PulseStopperWep_NormalBar : NormalBar { args 4, 58 }

actor PulseStopperWep : BaseMM8BDMWep 
{
	//$Category MM8BDM-Weapons
	//$Title Pulse Stopper
	Weapon.AmmoUse 1
	Weapon.AmmoGive 28
	Weapon.SlotNumber 4
	Inventory.Pickupmessage "$PU_PULSESTOPPER"
	Obituary "$OB_PULSESTOPPER"
	Tag "$TAG_PULSESTOPPER"
	weapon.ammotype "PulseStopperAmmo"
	inventory.icon "PSTOPI"
	States
	{
		SpawnLoop:
			PSTP A -1
			loop
			
		Ready:
			PSTP A 0 ACS_NamedExecuteWithResult("core_weaponcolor",CLR_PULSESTOPPER)
			PSTP C 1 A_WeaponReady
			Goto Ready+1
			
		Deselect:
			PSTP C 0 A_TakeInventory("ShieldCheck", 1)
			goto DeselectSwap
		Select:
			PSTP C 0
			goto SelectSwap
			
		Fire:
			PSTP A 0 A_JumpIfNoAmmo("NoAmmo")
			PSTP DE 1
			PSTP D 0 A_GiveInventory("ShieldCheck", 1)
			PSTP D 0 A_SpawnItemEx("PulseStopperWarper", 2, 0, 32, momx, momy, momz, 0, SXF_ABSOLUTEMOMENTUM, 0)
			PSTP C 0 A_PlaySoundEx("weapon/pulse","Weapon")
			Goto Hold
		Hold:
			PSTP A 0 A_JumpIfNoAmmo("NoAmmo")
			TNT1 A 0 A_JumpIfInventory("IsBot", 1, "Botfire")
			PSTP E 1 A_SpawnItemEx("PulseStopRadius",2,0,32)
			PSTP E 0 A_Refire("Wait1")
			Goto Throw1
		Wait1:
			PSTP E 1
			PSTP E 0 A_Refire("Wait2")
			Goto Throw1
		Wait2:
			PSTP E 1
			PSTP E 0 A_Refire("Hold")
			Goto Throw1
		Throw1:
			PSTP A 0 A_TakeInventory("ShieldCheck", 1)
			PSTP A 0 A_FireCustomMissile("PulseStopper",0,1,0,0)
			PSTP ED 5
			PSTP C 12 A_ClearRefire
			Goto Ready+1
		Botfire:
			PSTP EEEE 3 A_SpawnItemEx("PulseStopRadius",2,0,32,momx, momy, momz, 0, SXF_ABSOLUTEMOMENTUM, 0)
			goto Throw1
			
		Altfire:
			PSTP A 0 A_JumpIfNoAmmo("NoAmmo")
			PSTP DE 1
			PSTP E 3
			PSTP C 0 A_PlaySoundEx("weapon/pulse","Weapon")
			Goto Throw1
			
		NoAmmo:
			PSTP D 1 ACS_NamedExecuteAlways("core_noammo",0)
			PHAN A 0 A_Refire
			Goto Ready+1
	}
}

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

actor PulseStopper : BasicProjectile 
{
	+RIPPER
	+FORCEXYBILLBOARD
	Radius 10
	Height 10
	speed 16
	damage (CallACS("mmrf_cbm_damage", 9))
	damagetype "PulseStopper"
	Obituary "$OB_PULSESTOPPER"
	States
	{
		Spawn:
			PSTP B 1 bright
			loop
		Death:
			PSTP B 1 bright A_FadeOut(0.2)
			loop
	}
}

actor PulseStopRadius : BasicExplosion
{
	damagetype "PulseStopper"
	Obituary "$OB_PULSESTOPPER"
	renderstyle "none"
	States
	{
		Spawn:
			PSTP BB 0 A_Explode(CallACS("mmrf_cbm_damage", 9),96,0)
			stop
	}
}

actor PulseStopperWarper : BaseShieldWarper
{
	+BRIGHT
	States
	{
		Shield:
			PSTP B 1 A_Warp(AAPTR_TARGET, 2, 0, 32, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
			loop
	}
}
