//=============================================================================
// RazorAmmo.
//=============================================================================
class RazorAmmo expands Ammo;

#exec AUDIO IMPORT FILE="Sounds\Pickups\AMMOPUP1.WAV" NAME="AmmoSnd"       GROUP="Pickups"

#exec TEXTURE IMPORT NAME=I_RazorAmmo FILE=TEXTURES\HUD\i_razor.PCX GROUP="Icons"

#exec MESH IMPORT MESH=RazorAmmoMesh ANIVFILE=MODELS\rabox_a.3D DATAFILE=MODELS\rabox_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=RazorAmmoMesh X=0 Y=0 Z=0 YAW=0
#exec MESH SEQUENCE MESH=RazorAmmoMesh SEQ=All    STARTFRAME=0  NUMFRAMES=2
#exec MESH SEQUENCE MESH=RazorAmmoMesh SEQ=Open   STARTFRAME=0  NUMFRAMES=2
#exec TEXTURE IMPORT NAME=JPickup21 FILE=MODELS\pickup2.PCX GROUP="Skins"
#exec MESHMAP SCALE MESHMAP=RazorAmmoMesh X=0.05 Y=0.05 Z=0.1
#exec MESHMAP SETTEXTURE MESHMAP=RazorAmmoMesh NUM=1 TEXTURE=JPickup21

var bool bOpened;

auto state Pickup
{
	function Touch( Actor Other )
	{
		local Vector Dist2D;

		if ( bOpened )
		 CallParent.Touch(Other);
		if ( (Pawn(Other) == None) || !Pawn(Other).bIsPlayer )
			return;
		Dist2D = Other.Location - Location;
		Dist2D.Z = 0;
		if ( Size(Dist2D) <= 25.0 )
			CallParent.Touch(Other);
		else 
		{
			SetCollisionSize(20.0, CollisionHeight);
			SetLocation(Location); //to force untouch
			bOpened = true;
			PlayAnim('Open', 0.05);
		}
	}

	function Landed(vector HitNormal)
	{
		CallParent.Landed(HitNormal);
		if ( !bOpened )
			SetCollisionSize(170,CollisionHeight);
	}
}

