Permalink
Browse files

Fix default scoreboard sorting

* Fixes player lines jumping around every frame if 2 or more players are
in TEAM_UNCONNECTED
* Fixes scoreboard not rebuilding when player leaves, leaving empty
lines in some cases
  • Loading branch information...
1 parent 725505d commit 07d275566f7b7385533935217c26cbe1f5cbcc59 @robotboy655 robotboy655 committed Jan 24, 2015
Showing with 4 additions and 2 deletions.
  1. +4 −2 garrysmod/gamemodes/base/gamemode/cl_scoreboard.lua
@@ -82,6 +82,7 @@ local PLAYER_LINE = {
Think = function( self )
if ( !IsValid( self.Player ) ) then
+ self:SetZPos( 9999 ) -- Causes a rebuild
self:Remove()
return
end
@@ -126,15 +127,16 @@ local PLAYER_LINE = {
-- Connecting players go at the very bottom
--
if ( self.Player:Team() == TEAM_CONNECTING ) then
- self:SetZPos( 2000 )
+ self:SetZPos( 2000 + self.Player:EntIndex() )
+ return
end
--
-- This is what sorts the list. The panels are docked in the z order,
-- so if we set the z order according to kills they'll be ordered that way!
-- Careful though, it's a signed short internally, so needs to range between -32,768k and +32,767
--
- self:SetZPos( ( self.NumKills * -50 ) + self.NumDeaths )
+ self:SetZPos( ( self.NumKills * -50 ) + self.NumDeaths + self.Player:EntIndex() )
end,

0 comments on commit 07d2755

Please sign in to comment.