From b2b8954d124fa536c1b3f7486b4de14b4b6a6cf4 Mon Sep 17 00:00:00 2001 From: LostTrackpad Date: Wed, 7 Aug 2024 16:44:55 +0700 Subject: [PATCH] Fix goofy low health overlay stuff --- beatrun/gamemodes/beatrun/gamemode/sh/Damage.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Damage.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Damage.lua index 5d8277b..e2d506e 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Damage.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Damage.lua @@ -159,7 +159,7 @@ if CLIENT then local dmgalpha = 0 hook.Add("PreDrawHUD", "NTScreenEffects", function() - -- Not doing it this way breaks HUDs. And that's not cool. + -- Draw the overlay this way or we (sort of) break other HUDs. cam.Start2D() local ply = LocalPlayer() @@ -168,7 +168,8 @@ if CLIENT then local w = ScrW() local h = ScrH() - dmgalpha = math.min(300 * math.abs(ply:Health() / ply:GetMaxHealth() - 1), 255) + curhealth = math.Clamp(ply:Health(), 0, ply:GetMaxHealth()) + dmgalpha = math.min(300 * math.abs(curhealth / ply:GetMaxHealth() - 1), 255) surface.SetMaterial(radial) surface.SetDrawColor(0, 0, 0, dmgalpha * 0.58)