Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UI error when leaving the lobby too quickly #887

Merged
merged 9 commits into from
Nov 18, 2024
3 changes: 3 additions & 0 deletions Northstar.CustomServers/mod/scripts/vscripts/sh_loadouts.nut
Original file line number Diff line number Diff line change
Expand Up @@ -2813,6 +2813,9 @@ string function GetParentLoadoutProperty( string loadoutType, string propertyNam

int function GetPersistentSpawnLoadoutIndex( entity player, string loadoutType )
{
if (!IsValid ( player ) )
Zanieon marked this conversation as resolved.
Show resolved Hide resolved
return -1

int loadoutIndex = player.GetPersistentVarAsInt( loadoutType + "SpawnLoadout.index" )
if ( loadoutType == "titan" && loadoutIndex >= NUM_PERSISTENT_TITAN_LOADOUTS )
loadoutIndex = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,13 @@ void function UpdateCachedLoadouts_Threaded()
// below here is just making all the menu models update properly and such

#if UI
uiGlobal.pilotSpawnLoadoutIndex = GetPersistentSpawnLoadoutIndex( GetUIPlayer(), "pilot" )
uiGlobal.titanSpawnLoadoutIndex = GetPersistentSpawnLoadoutIndex( GetUIPlayer(), "titan" )
entity UIPlayer = GetUIPlayer()

if (!IsValid ( UIPlayer ) )
Zanieon marked this conversation as resolved.
Show resolved Hide resolved
return

uiGlobal.pilotSpawnLoadoutIndex = GetPersistentSpawnLoadoutIndex( UIPlayer, "pilot" )
uiGlobal.titanSpawnLoadoutIndex = GetPersistentSpawnLoadoutIndex( UIPlayer, "titan" )
#endif

#if CLIENT
Expand Down
Loading