Skip to content

Commit

Permalink
Improve draw checks
Browse files Browse the repository at this point in the history
  • Loading branch information
wrefgtzweve committed Sep 16, 2023
1 parent 2f42b76 commit f123155
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lua/autorun/client/cfc_attention_monitoring_cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ local fadeStart = 1250 ^ 2
local fadeEnd = 1750 ^ 2

local timeFont = "CFC_AM_FONT"
local RENDERMODE_TRANSALPHA = RENDERMODE_TRANSALPHA

surface.CreateFont( timeFont, {
font = "Arial",
Expand Down Expand Up @@ -52,9 +53,11 @@ local function formatAfkTime( rawTime )
end

local function drawIcon( ply )
if not IsValid( ply ) then return end
if ply == LocalPlayer() then return end
if not ply:Alive() then return end
if ply:IsDormant() then return end
if ply:GetRenderMode() == RENDERMODE_TRANSALPHA then return end
if not ply:GetNWBool( "CFC_AM_IsTabbedOut" ) then return end
if ply == LocalPlayer() then return end

-- Position
local pos
Expand Down Expand Up @@ -98,9 +101,7 @@ end

local function drawIcons()
for _, ply in ipairs( player.GetAll() ) do
if ply:GetNWBool( "CFC_AM_IsTabbedOut" ) then
drawIcon( ply )
end
drawIcon( ply )
end
end

Expand Down

0 comments on commit f123155

Please sign in to comment.