Skip to content

Commit

Permalink
Fix respawning for racing (#348)
Browse files Browse the repository at this point in the history
* Fix respawning for racing

* Also fix updating of struct in another place
  • Loading branch information
enteryournamehere authored Aug 28, 2023
1 parent 876189a commit de67faf
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,11 @@ private async Task OnPlayerLoad(Player player)
RacingPlayerInfo playerInfo;

if (IsPlayerRegistered(player)) {
playerInfo = Players.Find(info => info.Player.Id == player.Id);
var playerInfoIndex = Players.FindIndex(info => info.Player.Id == player.Id);
playerInfo = Players[playerInfoIndex];
playerInfo.Player = player;
playerInfo.PlayerLoaded = true;
Players[playerInfoIndex] = playerInfo;
} else {
playerInfo = new RacingPlayerInfo
{
Expand Down Expand Up @@ -378,8 +380,10 @@ private void LoadPlayerCar(Player player)
VehicleId = car,
});

var playerInfo = Players.Find(info => info.Player.Id == player.Id);
playerInfo.Vehicle = car;
var playerInfoIndex = Players.FindIndex(info => info.Player.Id == player.Id);
var tempInfo = Players[playerInfoIndex];
tempInfo.Vehicle = car;
Players[playerInfoIndex] = tempInfo;
}

private void InitRace()
Expand Down

0 comments on commit de67faf

Please sign in to comment.