Skip to content

Commit

Permalink
validate that selected titan loadout is within bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
ASpoonPlaysGames committed Nov 18, 2023
1 parent a937566 commit 8cb64d8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Northstar.CustomServers/mod/scripts/vscripts/sh_progression.nut
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,12 @@ void function ValidateEquippedItems( entity player )
}

// titan loadouts
int selectedTitanLoadoutIndex = player.GetPersistentVarAsInt( "titanSpawnLoadout.index" )
for ( int titanLoadoutIndex = 0; titanLoadoutIndex < NUM_PERSISTENT_TITAN_LOADOUTS; titanLoadoutIndex++ )
{
printt( "- VALIDATING TITAN LOADOUT: " + titanLoadoutIndex )

bool isSelected = titanLoadoutIndex == player.GetPersistentVarAsInt( "titanSpawnLoadout.index" )
bool isSelected = titanLoadoutIndex == selectedTitanLoadoutIndex
TitanLoadoutDef loadout = GetTitanLoadout( player, titanLoadoutIndex )
TitanLoadoutDef defaultLoadout = shGlobal.defaultTitanLoadouts[titanLoadoutIndex]

Expand Down Expand Up @@ -417,11 +418,18 @@ void function ValidateEquippedItems( entity player )
{
printt( " - SELECTED TITAN CLASS IS LOCKED, RESETTING" )
player.SetPersistentVar( "titanSpawnLoadout.index", 0 )
Remote_CallFunction_NonReplay( player, "ServerCallback_UpdateTitanModel", 0 )
selectedTitanLoadoutIndex = 0
}
}

Remote_CallFunction_NonReplay( player, "ServerCallback_UpdateTitanModel", player.GetPersistentVarAsInt( "titanSpawnLoadout.index" ) )
if ( selectedTitanLoadoutIndex < 0 || selectedTitanLoadoutIndex > NUM_PERSISTENT_TITAN_LOADOUTS )
{
printt( "- SELECTED TITAN CLASS IS INVALID, RESETTING" )
player.SetPersistentVar( "titanSpawnLoadout.index", 0 )
selectedTitanLoadoutIndex = 0
}

Remote_CallFunction_NonReplay( player, "ServerCallback_UpdateTitanModel", selectedTitanLoadoutIndex )

// pilot loadouts
for ( int pilotLoadoutIndex = 0; pilotLoadoutIndex < NUM_PERSISTENT_PILOT_LOADOUTS; pilotLoadoutIndex++ )
Expand Down

0 comments on commit 8cb64d8

Please sign in to comment.