Fixes and checks

This commit is contained in:
Fesiug 2024-01-08 03:39:20 -05:00
parent 0188306894
commit 9779bf5b48
2 changed files with 23 additions and 18 deletions

View File

@ -276,8 +276,10 @@ function OpenSMenu()
surface.SetDrawColor( schema("fg") )
surface.DrawRect( 0, 0, w, h )
local rang = WeaponGet( pan_active )
draw.SimpleText( rang.Name, "Benny_18", ss(2), ss(2), schema_c("bg") )
if pan_active then
local rang = WeaponGet( pan_active )
draw.SimpleText( rang.Name, "Benny_18", ss(2), ss(2), schema_c("bg") )
end
return true
end
end
@ -292,16 +294,18 @@ function OpenSMenu()
surface.SetDrawColor( schema("fg") )
surface.DrawRect( 0, 0, w, h )
local rang = WeaponGet( pan_active )
local multiline = multlinetext( rang.Description, w-ss(2), "Benny_12" )
for i, v in ipairs( multiline ) do
local line = i-1
local height = ss( 14 + (#multiline-1)*12 )
if lastheight != height then
BAR_DESC:SetTall( height )
lastheight = height
if pan_active then
local rang = WeaponGet( pan_active )
local multiline = multlinetext( rang.Description, w-ss(2), "Benny_12" )
for i, v in ipairs( multiline ) do
local line = i-1
local height = ss( 14 + (#multiline-1)*12 )
if lastheight != height then
BAR_DESC:SetTall( height )
lastheight = height
end
draw.SimpleText( v, "Benny_12", ss(2), ss(2+12*line), schema_c("bg") )
end
draw.SimpleText( v, "Benny_12", ss(2), ss(2+12*line), schema_c("bg") )
end
return true
@ -455,8 +459,12 @@ function OpenSMenu()
end
function button:DoRightClick()
RunConsoleCommand( "benny_debug_give", "mag_" .. New.ClassName )
chat.AddText( "Gave " .. WeaponGet("mag_"..New.ClassName).Name )
if ItemDef("mag_"..New.ClassName) then
RunConsoleCommand( "benny_debug_give", "mag_" .. New.ClassName )
chat.AddText( "Gave " .. ItemDef("mag_"..New.ClassName).Name )
else
chat.AddText( "That item doesn't exist. " .. "mag_"..New.ClassName )
end
end
function button:Think()

View File

@ -290,14 +290,12 @@ local col_1a = Color(100, 100, 255, 200)
local col_2 = Color(0, 0, 0, 255)
local col_3 = Color(255, 127, 127, 255)
local col_4 = Color(255, 222, 222, 255)
local heartbeatcol = Color(255, 255, 255, 255)
local mat_dot = Material("benny/hud/xhair/dotx.png", "smooth")
local mat_long = Material("benny/hud/xhair/long.png", "smooth")
local mat_dot_s = Material("benny/hud/xhair/dot_s.png", "mips smooth")
local mat_long_s = Material("benny/hud/xhair/long_s.png", "mips smooth")
local spacer_long = 3 -- screenscaled
local spacer = 1 -- screenscaled
local gap = 0
local trash_vec, trash_ang = Vector(), Angle()
@ -343,8 +341,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
surface.DrawOutlinedRect( b_x + b_s, b_y + b_s, ss(142-8), b_bh, ss( 0.5 ) )
surface.DrawRect( b_x + b_s + ss(1), b_y + b_s + ss(1), ss(142*hp-8-2), b_bh - ss(2) )
heartbeatcol.a = math.ease.OutQuint(1-ti)*255
surface.SetDrawColor( heartbeatcol )
surface.SetDrawColor( 255, 255, 255, math.ease.OutQuint(1-ti)*255 )
surface.SetMaterial( mat_grad )
surface.DrawTexturedRect( b_x + b_s + ss(1), b_y + b_s + ss(1), ss(142*hp*ti-8-2), b_bh - ss(2) )
@ -603,7 +600,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
cam.Start3D()
local lool = ( EyePos() + ( EyeAngles():Forward()*8192 ) + ( dispersion * EyeAngles():Up()*8192 ) ) :ToScreen()
cam.End3D()
gap = ( (ScrH()/2) - lool.y )
local gap = ( (ScrH()/2) - lool.y )
do
local tr1 = util.TraceLine({