namespace ITEM_KEVLAR
{

const string MODEL	= "models/snd/pcv_laying.mdl";
const string SOUND	= "sandstone/armoron_1.wav";

string ITEM_NAME	= "Kevlar Armor\n";
uint ITEM_PRICE		= 250;

class item_kevlar : ScriptBasePlayerAmmoEntity
{
	void Spawn()
	{ 
		Precache();
		g_EntityFuncs.SetSize( self.pev, Vector( -20, -15, 0 ), Vector( 20, 15, 15 ) );
		g_EntityFuncs.SetModel( self, MODEL );
		self.pev.body = 1;
		BaseClass.Spawn();
	}

	void Precache()
	{
		g_Game.PrecacheModel( MODEL );
		g_SoundSystem.PrecacheSound( SOUND );
		g_Game.PrecacheGeneric( "sound/" + SOUND );
		BaseClass.Precache();
	}

	bool AddAmmo( CBaseEntity@ pOther )
	{
		CBasePlayer@ pPlayer = cast<CBasePlayer@>( pOther );

		if( pPlayer !is null && pPlayer.pev.armorvalue < pPlayer.pev.armortype && pPlayer.HasSuit() )
		{
			pPlayer.pev.armorvalue = pPlayer.pev.armortype;

			g_SoundSystem.EmitSound( self.edict(), CHAN_ITEM, SOUND, 1, ATTN_NORM );
			return true;
		}
		return false;
	}
}

string GetName()
{
	return "item_kevlar";
}

void Register()
{
	if( g_CustomEntityFuncs.IsCustomEntity( GetName() ) )
		return;

	g_CustomEntityFuncs.RegisterCustomEntity( "ITEM_KEVLAR::item_kevlar", GetName() );
	g_Game.PrecacheOther( GetName() );
}
}