Skip to content

Commit

Permalink
Candidate fix for the loadout sync bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
CCraigen committed Oct 22, 2022
1 parent c97d45c commit b77306f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions GameMod/MPLoadouts.cs
Expand Up @@ -299,7 +299,17 @@ private static void OnSetCustomLoadoutMessage(NetworkMessage rawMsg)
{
var msg = rawMsg.ReadMessage<MPLoadouts.SetCustomLoadoutMessage>();
if (MPLoadouts.NetworkLoadouts.ContainsKey(msg.lobby_id))
{
MPLoadouts.NetworkLoadouts[msg.lobby_id].selected_idx = msg.selected_idx;

foreach (var player in Overload.NetworkManager.m_Players.Where(x => x.connectionToClient.connectionId > 0))
{
if (MPTweaks.ClientHasTweak(player.connectionToClient.connectionId, "customloadouts"))
{
NetworkServer.SendToClient(player.connectionToClient.connectionId, MessageTypes.MsgSetCustomLoadout, msg);
}
}
}
}
}
}
Expand Down Expand Up @@ -494,10 +504,10 @@ static void SetMultiplayerModifiers(Player player, LoadoutDataMessage loadout_da

static void SetMultiplayerLoadoutAndModifiers(Player player, LoadoutDataMessage loadout_data, bool use_loadout1, int lobby_id)
{

if (MPLoadouts.NetworkLoadouts.ContainsKey(lobby_id))
{
var loadout_idx = GameplayManager.IsDedicatedServer() ? MPLoadouts.NetworkLoadouts[lobby_id].selected_idx : Menus.mms_selected_loadout_idx;
//var loadout_idx = GameplayManager.IsDedicatedServer() ? MPLoadouts.NetworkLoadouts[lobby_id].selected_idx : Menus.mms_selected_loadout_idx;
var loadout_idx = player.isLocalPlayer ? Menus.mms_selected_loadout_idx : MPLoadouts.NetworkLoadouts[lobby_id].selected_idx;
SetMultiplayerModifiers(player, loadout_data, use_loadout1);
SetMultiplayerLoadout(player, lobby_id, loadout_idx);
}
Expand Down

0 comments on commit b77306f

Please sign in to comment.