AddCSLuaFile( "cl_init.lua" );
AddCSLuaFile( "shared.lua" );

include( "shared.lua" );

function ENT:Initialize()
	self.Entity:PhysicsInit( SOLID_VPHYSICS )
	self.Entity:SetMoveType( MOVETYPE_VPHYSICS );
	self.Entity:SetSolid( SOLID_VPHYSICS );
	self.Entity:SetUseType( SIMPLE_USE );
	
	self.Entity:GetPhysicsObject():Wake();
	self:SetNWString( "Name", self.InfoTable.Name );
end

function ENT:Use( activator, caller )
	if ( !activator:IsPlayer() ) then return false end;
	if ( !activator:HasInventorySpace( self.InfoTable.Unique ) ) then activator:ChatPrint( "Inventory is full!" ) return end;

	activator:GiveItem( self.InfoTable.Unique, 1 );
	activator:EmitSound( "items/ammocrate_open.wav" );
	self.InfoTable:OnPickup( activator );
	self:Remove();
	activator:ChatPrint( "Picked up " .. self.InfoTable.Name .. "." );
end;
