Как можно исправить это(проходит сквозь карту) причем у других не прописаных профессий не проходит
cl_visor.lua:
nameplates = {}
surface.CreateFont( "nameplates", {
font = "Roboto",
size = 17,
weight = 500,
antialias = true,
extended = true
} )
function nameplates.CalculateDecayInterpolation(percentPerTime)
local frameTime = RealFrameTime() * game.GetTimeScale()
local frac = math.pow(1 - percentPerTime, frameTime)
return 1 - frac
end
function ShitDrawTexture( mat, x, y, w, h, color )
surface.SetDrawColor( color or Color( 255, 255, 255 ) )
surface.SetMaterial( mat )
surface.DrawTexturedRect( x, y, w, h )
end
function nameplates.DrawNameplate(options)
if not options then return end
local ent = options.ent
local position = options.position
local angle = options.angle
local maxDistance = options.maxDistance
local aimThreshold = options.aimThreshold
local ignoreZ = options.ignoreZ
local lookCenter = options.lookCenter
local func = options.func
local uiScale = options.uiScale or 0.1
local lp = LocalPlayer()
if not IsValid(lp) then return end
local lpEye = lp:EyePos()
local eyeAng = EyeAngles()
local tr = lp:GetEyeTrace()
if not lookCenter then lookCenter = position end
local dot = lp:GetAimVector():Dot((lookCenter - lpEye):GetNormalized())
local dotThreshold = math.cos(aimThreshold or (math.pi / 10))
local bounds = ent:OBBMaxs() - ent:OBBMins()
local radius = bounds:Length() / 2
local dist = lpEye:Distance(position)
if dist < radius * 3 then
local f = math.Clamp((dist - radius) / (radius * 2), 0, 1)
dotThreshold = Lerp(f, 0, dotThreshold)
end
local flags = dot >= dotThreshold and (not maxDistance or dist <= maxDistance)
if ignoreZ and options.trace then
local traceStart = options.traceStart
if not traceStart then
traceStart = ent:LocalToWorld(ent:OBBCenter())
if ent:IsPlayer() then
traceStart = ent:GetShootPos()
end
end
local tr = util.TraceLine({
start = traceStart,
endpos = lpEye,
filter = options.traceFilter or { lp, ent }
})
flags = flags and not tr.Hit
end
if flags then
ent.UISize = Lerp(nameplates.CalculateDecayInterpolation(0.975), ent.UISize or 0, (dot - dotThreshold) / (1 - dotThreshold))
else
ent.UISize = math.Clamp(Lerp(nameplates.CalculateDecayInterpolation(0.975), ent.UISize or 0, -0.1), 0, 1)
end
local uiSize = ent.UISize or 0
if uiSize <= 0 then return end
if not angle then angle = (position - lpEye):Angle() end
local rotatedAngle = Angle(0, angle.y - 90, 90)
local pitch = math.NormalizeAngle(angle.p)
rotatedAngle:RotateAroundAxis(rotatedAngle:Forward(), math.Clamp(-pitch / 2, -25, 25))
local camScale = uiScale * uiSize
local camOffset = Vector(0, 0, 5 * uiSize)
if options.offset then
camOffset = camOffset + rotatedAngle:Up() * options.offset.x
camOffset = camOffset + rotatedAngle:Forward() * options.offset.y
camOffset = camOffset + rotatedAngle:Right() * -options.offset.z
end
if ignoreZ then cam.IgnoreZ(true) end
cam.Start3D2D(position + camOffset, rotatedAngle, camScale)
func(uiSize)
cam.End3D2D()
if ignoreZ then cam.IgnoreZ(false) end
end
local voices = {}
local font = "Default"
local icons = {}
surface.CreateFont("MetaHub_HudBig", {
font = "Roboto",
size = 50,
weight = 1000,
antialias = true,
extended = true
})
surface.CreateFont("MetaHub_HudMedium", {
font = "Roboto",
size = 23,
weight = 400,
antialias = true,
extended = true
})
local voices = {}
local fonts = {}
fonts.big = "MetaHub_HudBig"
fonts.medium = "MetaHub_HudMedium"
local icons = {}
icons.crosshairs = {}
icons.crosshairs[1] = Material("vgui/visor/asset.png","noclamp smooth") -- Стандарт
icons.crosshairs[2] = Material("vgui/visor/green.png","noclamp smooth") -- Тиммейт
icons.crosshairs[3] = Material("vgui/visor/deviant.png","noclamp smooth") -- В розыске
icons.crosshairs[4] = Material("vgui/visor/blue.png","noclamp smooth") -- Синий
icons.crosshairs[5] = Material("vgui/visor/target-priority.png","noclamp smooth") -- Приоритет / Цель #1
icons.crosshairs[6] = Material("vgui/visor/target.png","noclamp smooth") -- АК
icons.scan = Material("vgui/visor/scan.png","noclamp smooth")
icons.white = Material("vgui/visor/white.jpg","noclamp smooth")
local function DrawTOutlinedRect(x,y,w,h,texture,outline,color,coloro)
texture = texture or icons.scan
color = color or Color(255,255,255)
coloro = coloro or Color(0,0,0,255)
surface.SetDrawColor(color)
surface.SetMaterial(texture)
surface.DrawTexturedRect( x-2, y, w+4, h )
if outline == true then
surface.SetDrawColor(coloro)
surface.DrawOutlinedRect(x-2,y,w+4,h)
end
end
local function DrawRotated(x,y,w,h,texture,color,rot)
texture = texture or icons.scan
color = color or Color(255,255,255)
surface.SetDrawColor(color)
surface.SetMaterial(texture)
surface.DrawTexturedRectRotated( x-2, y, w+4, h, rot )
end
local function GetTTextSize(text,font)
font = font or "Default"
surface.SetFont(font)
local w,h = surface.GetTextSize(text or "")
return w,h
end
local function DrawTOutlinedText(x,y,text,font,color,back,texture,coloro)
texture = texture or icons.white
surface.SetFont(font)
local w,h = surface.GetTextSize(text or "")
if back == true then
surface.SetDrawColor(coloro or Color(0,0,0,255))
surface.SetMaterial(texture)
surface.DrawTexturedRect( x-2, y, w+4, h )
end
draw.SimpleText( text, font, x, y, color, TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
return w,h
end
icons.crosshairs[1] = Material("vgui/visor/asset.png","noclamp smooth") -- Стандарт
icons.crosshairs[2] = Material("vgui/visor/green.png","noclamp smooth") -- Тиммейт
icons.crosshairs[3] = Material("vgui/visor/deviant.png","noclamp smooth") -- В розыске
icons.crosshairs[4] = Material("vgui/visor/blue.png","noclamp smooth") -- Синий
icons.crosshairs[5] = Material("vgui/visor/target-priority.png","noclamp smooth") -- Приоритет / Цель #1
icons.crosshairs[6] = Material("vgui/visor/target.png","noclamp smooth") -- АК
function nameplates.DrawVisor(ply, pos)
local lp = LocalPlayer()
local name, id = ply:Name(), ply:GetID()
local job = lp:getDarkRPVar("job")
--local text,status,must = ply:GetNetVar('Visor::Title'), ply:GetNetVar('Visor::Status'), ply:GetNetVar('Visor::Sovet')
--local main, icon = ply:GetNetVar('Visor::Color'), ply:GetNetVar('Visor::ID')
local w,h = GetTTextSize(text, fonts.big)
local presentAngle = (CurTime() * 90) % 360
local mat = icons.crosshairs[icon]
nameplates.DrawNameplate({
ent = ply,
position = pos,
angle = lp:GetAngles(),
maxDistance = 256,
lookCenter = ply:LocalToWorld(ply:OBBCenter() + Vector(0, 0, 10)),
aimThreshold = math.pi / 6,
func = function(uiSize)
--local team = ply:GetNetVar('DisguiseTeam') != nil and ply:GetNetVar('DisguiseTeam') or ply:Team()
--local tTeable = rp.teams[team]
local iscp = ply:isMP() --ply:IsDisguised() and tTeable.cp
if iscp then
DrawRotated(0, 0, 128, 128, icons.crosshairs[2], nil, presentAngle)
else
DrawRotated(0, 0, 128, 128, mat, nil, presentAngle)
end
local xbase,ybase = 70,-32
local stndx,stndy = xbase,ybase
DrawTOutlinedRect(xbase, ybase, 256, 128, icons.scan, true, Color(255,255,255), Color(0,0,0,100))
-- DrawTOutlinedRect(xbase, ybase, 256, 128, icons.scan, false, Color(0,0,0,150))
ybase = ybase-h+2
DrawTOutlinedRect(xbase, ybase, w, h, icons.scan, false, Color(0,0,0,150))
if iscp then
DrawTOutlinedText(xbase, ybase, "//", fonts.big, Color(255,255,255, 100), true, icons.scan, Color(0,0,0,255))
DrawTOutlinedText(xbase, ybase, " ЮНИТ", fonts.big, Color(52,225,32, 210), true, icons.scan, Color(0,0,0,255))
else
DrawTOutlinedText(xbase, ybase, text, fonts.big, main, true, icons.scan, Color(0,0,0,255))
end
----------- Inside Box stuff ---------
xbase,ybase = stndx,stndy
xbase = xbase + 2
ybase = ybase + 2
DrawTOutlinedRect(xbase, ybase, 252, 80.5, nil, false, Color(255,255,255,10))
w,h = DrawTOutlinedText(xbase, ybase,"ИМЯ: ", fonts.medium, Color(200,200,200), false)
DrawTOutlinedText(xbase+w, ybase, name, fonts.medium, Color(200,200,200), true, icons.scan, Color(0,0,0,255))
ybase = ybase+h+2
w,h = DrawTOutlinedText(xbase, ybase,"CID: ", fonts.medium, Color(200,200,200), false)
DrawTOutlinedText(xbase+w, ybase, "#"..ply:GetID(), fonts.medium, Color(200,200,200))
ybase = ybase+h+2
w,h = DrawTOutlinedText(xbase, ybase,"СТАТУС: ", fonts.medium, Color(200,200,200), false)
if iscp then
DrawTOutlinedText(xbase+w, ybase, 'СОТРУДНИК ГО', fonts.medium, Color(200,200,200))
else
DrawTOutlinedText(xbase+w, ybase, status, fonts.medium, Color(200,200,200))
end
xbase = stndx+2
ybase = ybase + h*2
w,h = DrawTOutlinedText(xbase, ybase,"СОВЕТ: ", fonts.medium, Color(200,200,200), false)
if iscp then
DrawTOutlinedText(xbase+w, ybase, 'ЗАЩИЩАТЬ', fonts.medium, Color(52,225,32), true, icons.scan, main)
else
DrawTOutlinedText(xbase+w, ybase, must, fonts.medium, ply:GetNetVar('Visor::Color'), true, icons.scan, main)
end
end
})
end
local function OTAVisor( ply )
if ply == LocalPlayer() then return end
if ply:GetNoDraw() then return end
if not LocalPlayer():isOTA() then return end
local pos = ply:GetPos() + Vector(0,0,64)
local bone = ply:LookupBone("ValveBiped.Bip01_Head1")
if bone == nil then
bone = 0
else
pos = ply:GetBonePosition(bone)
end
nameplates.DrawVisor(ply, pos - Vector(0,0,4)-LocalPlayer():GetForward()*7 or ply:EyePos())
end
hook.Add( "PostPlayerDraw", "MetaHub::OTA::Visor", OTAVisor)
hook.Remove("RenderScreenspaceEffects", "RenderColorModify")