Spectator HUD Fix

When spectating a player and spawning back in the spectator HUD still shows, the following code fixes this. The old fix was to go into 3rd Person and back to 1st Person Mode.
This commit is contained in:
Josh 2017-10-21 11:20:49 -05:00 committed by GitHub
parent 3d88b2edf2
commit 68a6a8e67c

View File

@ -15,45 +15,31 @@ function LocalizeText()
SetObject("localizedText", TempObject);
}
function UpdateSpectateeInfo(optional bool bForceUpdate)
function UpdatePlayerInfo( optional bool bForceUpdate )
{
local GFxObject TempObject;
local ExtPlayerReplicationInfo E;
E = ExtPlayerReplicationInfo(SpectatedKFPRI);
if( !GetPC().IsSpectating() || E==None )
{
if( !bUnsetInfo )
{
SetVisible(false);
bUnsetInfo = true;
}
if( SpectatedKFPRI == None )
return;
}
// Update the perk class.
if( ExtLastPerkClass!=E.ECurrentPerk || LastPerkLevel!=E.ECurrentPerkLevel || bForceUpdate || bUnsetInfo )
E = ExtPlayerReplicationInfo(SpectatedKFPRI);
if( LastPerkLevel != E.ECurrentPerkLevel || LastPerkLevel != E.ECurrentPerkLevel || bForceUpdate )
{
LastPerkLevel = E.ECurrentPerkLevel;
ExtLastPerkClass = E.ECurrentPerk;
UpdatePlayerInfo(bForceUpdate);
bUnsetInfo = false;
}
}
function UpdatePlayerInfo(optional bool bForceUpdate)
{
local GFxObject TempObject;
TempObject = CreateObject("Object");
TempObject.SetString("playerName", SpectatedKFPRI.GetHumanReadableName());
if( ExtLastPerkClass!=None )
TempObject = CreateObject( "Object" );
TempObject.SetString( "playerName", SpectatedKFPRI.GetHumanReadableName() );
if( ExtLastPerkClass!=None && TempObject !=None )
{
TempObject.SetString("playerPerk", SpectatedKFPRI.CurrentPerkClass.default.LevelString @LastPerkLevel @ExtLastPerkClass.default.PerkName );
TempObject.SetString("iconPath", ExtLastPerkClass.Static.GetPerkIconPath(LastPerkLevel));
TempObject.SetString( "playerPerk", SpectatedKFPRI.CurrentPerkClass.default.LevelString @LastPerkLevel @ExtLastPerkClass.default.PerkName );
TempObject.SetString( "iconPath", ExtLastPerkClass.Static.GetPerkIconPath(LastPerkLevel) );
SetObject( "playerData", TempObject );
}
else TempObject.SetString( "playerPerk","No perk" );
SetVisible( true );
}
else TempObject.SetString("playerPerk","No perk");
SetObject("playerData", TempObject);
SetVisible(true);
}
defaultproperties