Skip to content

Commit

Permalink
Expose SF.IsHUDActive on the serverside as Player.isHUDActive (#1595)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnejm authored Jan 11, 2024
1 parent 8e6153f commit 041c6be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/starfall/libs_cl/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2056,8 +2056,8 @@ function render_library.traceSurfaceColor(vec1, vec2)
return cwrap(render.GetSurfaceColor(vunwrap(vec1), vunwrap(vec2)):ToColor())
end

--- Checks if a hud component is connected to the Starfall Chip
-- @return boolean Whether a hud component is connected to the SF Chip and active
--- Checks if the client is connected to a HUD component that's linked to this chip
-- @return boolean True if a HUD component is connected and active, nil otherwise
function render_library.isHUDActive()
return SF.IsHUDActive(instance.entity)
end
Expand Down
7 changes: 7 additions & 0 deletions lua/starfall/libs_sh/players.lua
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,13 @@ if SERVER then
ply:SetModelScale(math.Clamp(math.Truncate(scale, 2), 0.01, playerMaxScale:GetFloat()))
end

--- Checks if the player is connected to a HUD component that's linked to this chip
-- @server
-- @return boolean True if a HUD component is connected and active for the player, nil otherwise
function player_methods:isHUDActive()
return SF.IsHUDActive(instance.entity, getply(self))
end

--- Sets the view entity of the player. Only works if they are linked to a hud.
-- @server
-- @param Entity ent Entity to set the player's view entity to, or nothing to reset it
Expand Down

0 comments on commit 041c6be

Please sign in to comment.