namespace ITEM_AMMOPACKLARGE
{

const string MODEL	= "models/w_chainammo.mdl";
const string SOUND	= "items/9mmclip1.wav";

class item_ammopack_large : ScriptBasePlayerAmmoEntity
{
	void Spawn()
	{ 
		Precache();
		g_EntityFuncs.SetSize( self.pev, Vector( -60, -60, 0 ), Vector( 60, 60, 60 ) );
		g_EntityFuncs.SetModel( self, MODEL );
		self.pev.body = 1;
		BaseClass.Spawn();
		self.pev.spawnflags = 7168; //comment if you don't want it to never respawn and disappear like dropped weapons

		g_EntityFuncs.DispatchKeyValue(self.edict(), "scale", "1.2");
		g_EntityFuncs.DispatchKeyValue(self.edict(), "rendermode", 0);
		g_EntityFuncs.DispatchKeyValue(self.edict(), "renderfx", 19);
		g_EntityFuncs.DispatchKeyValue(self.edict(), "rendercolor", "255 0 75");
	}

	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.GiveAmmo( 100, "health", 100, false );
			pPlayer.GiveAmmo( 250, "9mm", 250, false );
			pPlayer.GiveAmmo( 36, "357", 36, false );
			pPlayer.GiveAmmo( 125, "buckshot", 125, false );
			pPlayer.GiveAmmo( 150, "bolts", 50, false );
			pPlayer.GiveAmmo( 600, "556", 600, false );
			pPlayer.GiveAmmo( 10, "argrenades", 10, false );
			pPlayer.GiveAmmo( 5, "rockets", 5, false );
			pPlayer.GiveAmmo( 100, "uranium", 100, false );
			pPlayer.GiveAmmo( 100, "hornets", 100, false );
			pPlayer.GiveAmmo( 10, "hand grenade", 10, false );
			pPlayer.GiveAmmo( 5, "trip mine", 5, false );
			pPlayer.GiveAmmo( 15, "snarks", 15, false );
			pPlayer.GiveAmmo( 5, "satchel charge", 5, false );
			pPlayer.GiveAmmo( 15, "m40a1", 15, false );
			pPlayer.GiveAmmo( 30, "sporeclip", 30, false );
			pPlayer.GiveAmmo( 100, "shock charges", 100, false );

			g_SoundSystem.EmitSoundDyn( self.edict(), CHAN_ITEM, SOUND, 1.0, ATTN_NONE, SND_SKIP_ORIGIN_USE_ENT, PITCH_NORM, pPlayer.entindex() );
			return true;
		}
		return false;
	}
}

string GetName()
{
	return "item_ammopack_large";
}

void Register()
{
	if( g_CustomEntityFuncs.IsCustomEntity( GetName() ) )
		return;

	g_CustomEntityFuncs.RegisterCustomEntity( "ITEM_AMMOPACKLARGE::item_ammopack_large", GetName() );
	g_Game.PrecacheOther( GetName() );
}
}