----------------------------
-- CakeScript (March 29, 2008)
-- by LuaBanana
--
-- Alpha Version
-- player_shared.lua
----------------------------
local meta = FindMetaTable( "Player" );

function meta:CanTraceTo( ent ) -- Can the player and the entity "see" eachother?

	local trace = { }
	trace.start = self:EyePos();
	trace.endpos = ent:EyePos();
	trace.filter = self;
	
	local tr = util.TraceLine( trace );
	
	if( tr.Entity:IsValid() and tr.Entity:EntIndex() == ent:EntIndex() ) then return true; end
	
	return false;

end

function meta:Nick()
	
	return self:GetNWString("rpname");

end

function meta:CalcDrop()

	local pos = self:GetShootPos();
	local ang = self:GetAimVector();
	local tracedata = {};
	tracedata.start = pos;
	tracedata.endpos = pos+(ang*80);
	tracedata.filter = self;
	local trace = util.TraceLine(tracedata);
	
	return trace.HitPos;
	
end

function meta:SetDefaultVars()

	self:SetNWInt("LastDoorKick", 0);
	self:SetNWFloat("conscious", 100);
	self:SetNWInt("ko", 0);
	self:SetNWInt("ragdoll", 0);
	self:SetNWInt("health", 100);
	self:SetNWFloat("sprint", 100);
	self:SetNWInt("lastjump", 0);
	self:SetNWInt("lasthurt", 0);
	--self:SetAccField("group_max_props", 0, true);
	--self:SetAccField("group_max_ragdolls", 0, true);
	--self:SetAccField("group_max_effects", 0, true);
	--self:SetAccField("group_max_vehicles", 0, true);
	--self:SetAccField("group_max_sents", 0, true);
	--self:SetAccField("group_max_npcs", 0, true);
end