Made near death effects better and added death effects

master
AlmTech 5 years ago
parent a598e9c327
commit cc20c5cf6f
  1. 42
      gamemode/core/client/cl_hud.lua

@ -26,24 +26,26 @@ function GM:HUDPaint()
local maxhp = LocalPlayer():GetMaxHealth() local maxhp = LocalPlayer():GetMaxHealth()
if( Quantum.Client.Config.EnableHUD ) then if( Quantum.Client.Config.EnableHUD ) then
if !LocalPlayer():Alive() then return end if( !LocalPlayer():Alive() ) then
surface.SetDrawColor( 0, 0, 0, 255 )
-- Health border surface.DrawRect( 0, 0, sw, sh )
surface.SetDrawColor( 0, 0, 0, 200 ) else
surface.DrawRect( sw/2 - barW/2, sh*0.9, barW, barH ) -- Health border
surface.SetDrawColor( 0, 0, 0, 200 )
-- Health surface.DrawRect( sw/2 - barW/2, sh*0.9, barW, barH )
surface.SetDrawColor( 168, 62, 50, 255 )
surface.DrawRect( ( sw/2 - barW/2 ) + padding/2, (sh*0.9) + padding/2, math.Clamp( (barW - padding) * hp/maxhp, 0, barW - padding ), barH - padding ) -- Health
surface.SetDrawColor( 168, 62, 50, 255 )
-- Text surface.DrawRect( ( sw/2 - barW/2 ) + padding/2, (sh*0.9) + padding/2, math.Clamp( (barW - padding) * hp/maxhp, 0, barW - padding ), barH - padding )
surface.SetFont( "q_HUD" )
surface.SetTextColor( 255, 255, 255, 255 )
local hptxt = tostring( 100 * (hp/maxhp) .. "%" )
local txtW, txtH = surface.GetTextSize( hptxt )
surface.SetTextPos( ( ( sw/2 - txtW/2 ) + padding/2 ), ( ( sh*0.9 - txtH/2 ) ) )
surface.DrawText( hptxt )
-- Text
surface.SetFont( "q_HUD" )
surface.SetTextColor( 255, 255, 255, 255 )
local hptxt = tostring( 100 * (hp/maxhp) .. "%" )
local txtW, txtH = surface.GetTextSize( hptxt )
surface.SetTextPos( ( ( sw/2 - txtW/2 ) + padding/2 ), ( ( sh*0.9 - txtH/2 ) ) )
surface.DrawText( hptxt )
end
end end
end end
@ -55,9 +57,9 @@ hook.Add( "RenderScreenspaceEffects", "Quantum_HUD_RenderLowHealth", function()
[ "$pp_colour_addr" ] = 0, [ "$pp_colour_addr" ] = 0,
[ "$pp_colour_addg" ] = 0, [ "$pp_colour_addg" ] = 0,
[ "$pp_colour_addb" ] = 0, [ "$pp_colour_addb" ] = 0,
[ "$pp_colour_brightness" ] = Lerp( LocalPlayer():Health() / LocalPlayer():GetMaxHealth(), -0.75, 0 ), [ "$pp_colour_brightness" ] = Lerp( LocalPlayer():Health() / LocalPlayer():GetMaxHealth(), -0.5, 0 ),
[ "$pp_colour_contrast" ] = Lerp( LocalPlayer():Health() / LocalPlayer():GetMaxHealth(), 0.6, 1 ), [ "$pp_colour_contrast" ] = Lerp( LocalPlayer():Health() / LocalPlayer():GetMaxHealth(), 0.7, 1 ),
[ "$pp_colour_colour" ] = Lerp( LocalPlayer():Health() / LocalPlayer():GetMaxHealth(), 0.2, 1 ), [ "$pp_colour_colour" ] = Lerp( LocalPlayer():Health() / LocalPlayer():GetMaxHealth(), 0.8, 1 ),
[ "$pp_colour_mulr" ] = 0, [ "$pp_colour_mulr" ] = 0,
[ "$pp_colour_mulg" ] = 0, [ "$pp_colour_mulg" ] = 0,
[ "$pp_colour_mulb" ] = 0 [ "$pp_colour_mulb" ] = 0

Loading…
Cancel
Save