mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-29 05:13:02 +05:00
Make low health overlay not draw over HUDs
This commit is contained in:
parent
ba49b787c9
commit
900de4c9f4
1 changed files with 15 additions and 12 deletions
|
@ -158,7 +158,9 @@ if CLIENT then
|
|||
local radial = Material("radial.png")
|
||||
local dmgalpha = 0
|
||||
|
||||
hook.Add("HUDPaint", "NTScreenEffects", function()
|
||||
hook.Add("PreDrawHUD", "NTScreenEffects", function()
|
||||
-- Not doing it this way breaks HUDs. And that's not cool.
|
||||
cam.Start2D()
|
||||
local ply = LocalPlayer()
|
||||
|
||||
if not ply:Alive() then return end
|
||||
|
@ -169,10 +171,11 @@ if CLIENT then
|
|||
dmgalpha = math.min(300 * math.abs(ply:Health() / ply:GetMaxHealth() - 1), 255)
|
||||
|
||||
surface.SetMaterial(radial)
|
||||
surface.SetDrawColor(0, 0, 0, dmgalpha * 0.85)
|
||||
surface.SetDrawColor(0, 0, 0, dmgalpha * 0.58)
|
||||
surface.DrawTexturedRect(0, 0, ScrW(), ScrH())
|
||||
surface.DrawTexturedRectRotated(ScrW() * 0.5, ScrH() * 0.5, ScrW(), ScrH(), 180)
|
||||
surface.SetDrawColor(255, 25, 25, dmgalpha * math.max(0, math.sin(CurTime() * 6) * 0.045))
|
||||
surface.SetDrawColor(255, 25, 25, dmgalpha * math.max(0, math.sin(CurTime() * 6) * 0.09))
|
||||
surface.DrawTexturedRect(0, 0, w, h)
|
||||
cam.End2D()
|
||||
end)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue