include('shared.lua')

function ENT:Initialize()
end

function ENT:Draw()
	local ply = self:GetNWEntity("UCPlayer");
	if (ValidEntity(ply) && ply:Alive()) then
		/*if (ply.Talkin || false) then
			local flux = (5 + (math.sin((CurTime() * GAMEMODE.PigWiggleVelocity)) * 5));
			flux = math.Clamp(flux, 0, 10);
			ply:SetPoseParameter("snout", flux);
			self:SetPoseParameter("snout", flux);
		else
			if (ply:GetPoseParameter("snout") != 0) then
				ply:SetPoseParameter("snout", 0);
				self:SetPoseParameter("snout", 0);
			end
		end*/
		if ((LocalPlayer() == ply && ply:GetNWBool("UCScared")) || ply:GetNWBool("Taunting", false)) then
			self:DrawModel();
		end
	end
end

function ENT:Think()
	local ply = self:GetNWEntity("UCPlayer");
	if (ValidEntity(ply)) then
		if (ply.Talkin || false) then
			local flux = (5 + (math.sin((CurTime() * GAMEMODE.PigWiggleVelocity)) * 5));
			flux = math.Clamp(flux, 0, 10);
			ply:SetPoseParameter("snout", flux);
			self:SetPoseParameter("snout", flux);
		else
			/*if (ply:GetPoseParameter("snout") != 0) then
				ply:SetPoseParameter("snout", 0);
				self:SetPoseParameter("snout", 0);
			end*/
		end
	end
	self:NextThink(CurTime());
	return true;
end
