ACTOR MagazineBase
{
	BounceType "Doom"
	BounceFactor 0.6
	WallBounceFactor 0.6
	BounceSound "magazine/bounce"
	Projectile
	-NOGRAVITY
	-SOLID
	+CLIENTSIDEONLY
	+MOVEWITHSECTOR
	+MISSILE
	Radius 4
	Height 4
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_Jump(256, "SetSprite")
			Goto SetSprite
		
		SetSprite:
			TNT1 A 0
			Goto Main
		
		Main:
			"####" ABCDEFGHIJKLMNOPQRABCDEFGHIJKLMNOPQR 1
			Goto AirCheck
		AirCheck:
			"####" ABCDEFGHIJKLMNOPQR 1 A_JumpIf((MomX*MomX)+(MomY*MomY)+(MomZ*MomZ) < 10, "Death")
			Loop
			
		Death:
			"####" "#" 0 A_Jump(256,"SetRestSprite")
			Goto SetRestSprite
			
		SetRestSprite:
			"####" "#" 0
			Goto Rest
			
		Rest:
			"####" "#" 300
			"####" "#" 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "TryVanish")
			Loop
			
		TryVanish:
			"####" "#" 0 A_CheckSight("Vanish")
			Goto Rest
			
		Vanish:
			TNT1 A 1
			Stop
	}
}

// Pretty much all reload weapons use this
ACTOR PistolMagazine : MagazineBase
{
	Scale 0.075
	States
	{
		SetSprite:
			PMAG A 0
			Goto Super::Main
		SetRestSprite:
			PMAG X 0 A_Jump(128, 1)
			Goto Super::Rest
			PMAG Y 0 A_Jump(128, 1)
			Goto Super::Rest
			PMAG Z 0
			Goto Super::Rest
	}
}

ACTOR CookerMagazine : MagazineBase
{
	BounceSound "magazine/bounce"
	Scale 0.20
	States
	{
		SetSprite:
			CKMG ABCDEFGHIJKLMNOPQRSTUVWX 1
			Goto AirCheck
		AirCheck:
			CKMG ABCDEFGHIJKLMNOPQRSTUVWX 1 A_JumpIf((MomX*MomX)+(MomY*MomY)+(MomZ*MomZ) < 10, "Death")
			Loop
		SetRestSprite:
			CKMG Z 0
			Goto Super::Rest
	}
}

ACTOR M16Magazine : MagazineBase
{
	Scale 0.125
	States
	{
		SetSprite:
			MMAG A 0
			Goto Super::Main
		SetRestSprite:
			MMAG S 0 A_Jump(128, 1)
			Goto Super::Rest
			MMAG T 0
			Goto Super::Rest
	}
}

ACTOR 40MMShell : MagazineBase
{
	BounceSound "40mm/bounce"
	Scale 0.125
	States
	{
		SetSprite:
			40M1 A 0
			Goto Super::Main
		SetRestSprite:
			40M1 S 0 A_Jump(128, 1)
			Goto Super::Rest
			40M1 T 0
			Goto Super::Rest
	}
}

ACTOR M1Clip : MagazineBase
{
	Scale 0.1
	Speed 6
	BounceSound "m1garand/ping"
	States
	{
		SetSprite:
			M1CL A 0
			Goto Super::Main
		SetRestSprite:
			M1CL A 0 A_Jump(128, 1)
			Goto Super::Rest
			M1CL J 0
			Goto Super::Rest
	}
}

ACTOR M1FullClip : MagazineBase
{
	Scale 0.1
	Speed 6
	BounceSound "m1garand/ping"
	States
	{
		SetSprite:
			M2CL A 0
			Goto Super::Main
		SetRestSprite:
			M2CL A 0 A_Jump(128, 1)
			Goto Super::Rest
			M2CL J 0
			Goto Super::Rest
	}
}