Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Evil Factory
2025-12-08 12:35:44 -03:00
122 changed files with 1614 additions and 819 deletions
@@ -239,6 +239,13 @@ namespace Barotrauma.Networking
}
return;
}
//if we're still downloading mods, we're not ready to receive the campaign save
if (fileType == (byte)FileTransferType.CampaignSave && Screen.Selected is ModDownloadScreen)
{
GameMain.Client.CancelFileTransfer(transferId);
return;
}
if (!ValidateInitialData(fileType, fileName, fileSize, out string errorMsg))
{
@@ -562,6 +562,11 @@ namespace Barotrauma.Networking
{
SendLobbyUpdate();
}
if (Timing.TotalTime > LastMissingCampaignSubRequestTime)
{
TryRequestMissingCampaignSubs();
LastMissingCampaignSubRequestTime = Timing.TotalTime + MissingCampaignSubRequestInterval;
}
}
if (ServerSettings.VoiceChatEnabled)
@@ -2284,13 +2289,7 @@ namespace Barotrauma.Networking
if (GameMain.Client.IsServerOwner) { RequestSelectMode(modeIndex); }
}
if (GameMain.NetLobbyScreen.SelectedMode == GameModePreset.MultiPlayerCampaign)
{
foreach (SubmarineInfo sub in ServerSubmarines.Where(s => !ServerSettings.HiddenSubs.Contains(s.Name)))
{
GameMain.NetLobbyScreen.CheckIfCampaignSubMatches(sub, NetLobbyScreen.SubmarineDeliveryData.Campaign);
}
}
TryRequestMissingCampaignSubs();
GameMain.NetLobbyScreen.SetAllowSpectating(allowSpectating);
GameMain.NetLobbyScreen.SetAllowAFK(allowAFK);
@@ -2646,6 +2645,21 @@ namespace Barotrauma.Networking
ClientPeer?.Send(msg, DeliveryMethod.Reliable);
}
private double LastMissingCampaignSubRequestTime;
const double MissingCampaignSubRequestInterval = 10.0f;
private void TryRequestMissingCampaignSubs()
{
if (GameMain.NetLobbyScreen.SelectedMode == GameModePreset.MultiPlayerCampaign)
{
foreach (SubmarineInfo sub in ServerSubmarines.Where(s => !ServerSettings.HiddenSubs.Contains(s.Name)))
{
GameMain.NetLobbyScreen.CheckIfCampaignSubMatches(sub, NetLobbyScreen.SubmarineDeliveryData.Campaign);
}
}
}
public void RequestFile(FileTransferType fileType, string file, string fileHash)
{
DebugConsole.Log(
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -91,7 +91,7 @@ namespace Barotrauma.Networking
});
initializationStep = ConnectionInitialization.AuthInfoAndVersion;
timeout = NetworkConnection.TimeoutThreshold;
timeout = NetworkConnection.TimeoutThresholdNotInGame;
heartbeatTimer = 1.0;
isActive = true;
@@ -139,7 +139,7 @@ namespace Barotrauma.Networking
timeout = Screen.Selected == GameMain.GameScreen
? NetworkConnection.TimeoutThresholdInGame
: NetworkConnection.TimeoutThreshold;
: NetworkConnection.TimeoutThresholdNotInGame;
var (_, packetHeader, initialization) = INetSerializableStruct.Read<PeerPacketHeaders>(inc);