Merge pull request #6 from Regalis11/master

Thunder Under The Ice repo update
This commit is contained in:
Evil Factory
2021-06-17 12:35:28 -03:00
committed by GitHub
346 changed files with 13150 additions and 4263 deletions
@@ -381,7 +381,7 @@ namespace Barotrauma.Networking
if (gameStarted)
{
if (respawnManager != null) { respawnManager.Update(deltaTime); }
respawnManager?.Update(deltaTime);
entityEventManager.Update(connectedClients);
@@ -409,10 +409,7 @@ namespace Barotrauma.Networking
}
}
if (TraitorManager != null)
{
TraitorManager.Update(deltaTime);
}
TraitorManager?.Update(deltaTime);
if (serverSettings.Voting.VoteRunning)
{
@@ -436,7 +433,7 @@ namespace Barotrauma.Networking
connectedClients.All(c => c.Character == null || c.Character.IsDead || c.Character.IsIncapacitated);
bool subAtLevelEnd = false;
if (Submarine.MainSub != null && Submarine.MainSubs[1] == null)
if (Submarine.MainSub != null && !(GameMain.GameSession.GameMode is PvPMode))
{
if (Level.Loaded?.EndOutpost != null)
{
@@ -491,8 +488,10 @@ namespace Barotrauma.Networking
}
else if (isCrewDead && (GameMain.GameSession?.GameMode is CampaignMode))
{
#if !DEBUG
endRoundDelay = 1.0f;
endRoundTimer += deltaTime;
#endif
}
else
{
@@ -540,7 +539,8 @@ namespace Barotrauma.Networking
initiatedStartGame = false;
}
}
else if (Screen.Selected == GameMain.NetLobbyScreen && !gameStarted && !initiatedStartGame)
else if (Screen.Selected == GameMain.NetLobbyScreen && !gameStarted && !initiatedStartGame &&
(GameMain.NetLobbyScreen.SelectedMode != GameModePreset.MultiPlayerCampaign || GameMain.GameSession?.GameMode is MultiPlayerCampaign))
{
if (serverSettings.AutoRestart)
{
@@ -1210,6 +1210,7 @@ namespace Barotrauma.Networking
mpCampaign.ServerReadCrew(inc, sender);
}
}
private void ReadReadyToSpawnMessage(IReadMessage inc, Client sender)
{
sender.SpectateOnly = inc.ReadBoolean() && (serverSettings.AllowSpectating || sender.Connection == OwnerConnection);
@@ -1318,6 +1319,12 @@ namespace Barotrauma.Networking
if (gameStarted)
{
Log("Client \"" + GameServer.ClientLogName(sender) + "\" ended the round.", ServerLog.MessageType.ServerMessage);
if (mpCampaign != null && Level.IsLoadedOutpost)
{
mpCampaign.SaveInventories();
GameMain.GameSession.SubmarineInfo = new SubmarineInfo(GameMain.GameSession.Submarine);
SaveUtil.SaveGame(GameMain.GameSession.SavePath);
}
EndGame();
}
}
@@ -1495,7 +1502,6 @@ namespace Barotrauma.Networking
inc.ReadPadBits();
}
private void ClientWrite(Client c)
{
if (gameStarted && c.InGame)
@@ -1896,6 +1902,7 @@ namespace Barotrauma.Networking
}
outmsg.Write(serverSettings.RadiationEnabled);
outmsg.Write((byte)serverSettings.MaxMissionCount);
}
else
{
@@ -2254,10 +2261,6 @@ namespace Barotrauma.Networking
{
client.CharacterInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, client.Name);
}
else
{
client.CharacterInfo.ClearCurrentOrders();
}
characterInfos.Add(client.CharacterInfo);
if (client.CharacterInfo.Job == null || client.CharacterInfo.Job.Prefab != client.AssignedJob.First)
{
@@ -2343,7 +2346,8 @@ namespace Barotrauma.Networking
else
{
characterData.SpawnInventoryItems(spawnedCharacter, spawnedCharacter.Inventory);
characterData.ApplyHealthData(spawnedCharacter.Info, spawnedCharacter);
characterData.ApplyHealthData(spawnedCharacter);
characterData.ApplyOrderData(spawnedCharacter);
spawnedCharacter.GiveIdCardTags(mainSubWaypoints[i]);
characterData.HasSpawned = true;
}
@@ -2365,7 +2369,7 @@ namespace Barotrauma.Networking
if (hadBots)
{
//loaded existing bots -> init them
crewManager?.InitRound();
crewManager.InitRound();
}
else
{
@@ -2375,6 +2379,7 @@ namespace Barotrauma.Networking
}
campaign?.LoadPets();
crewManager?.LoadActiveOrders();
foreach (Submarine sub in Submarine.MainSubs)
{
@@ -2526,6 +2531,8 @@ namespace Barotrauma.Networking
{
mission.ServerWriteInitial(msg, client);
}
msg.Write(GameMain.GameSession.CrewManager != null);
GameMain.GameSession.CrewManager?.ServerWriteActiveOrders(msg);
}
public void EndGame(CampaignMode.TransitionType transitionType = CampaignMode.TransitionType.None)
@@ -3289,7 +3296,6 @@ namespace Barotrauma.Networking
if (voteType != VoteType.PurchaseSub)
{
SubmarineInfo newSub = GameMain.GameSession.SwitchSubmarine(targetSubmarine, deliveryFee);
GameMain.GameSession.Campaign.UpgradeManager.RefundResetAndReload(newSub, true);
}
serverSettings.Voting.StopSubmarineVote(true);
@@ -3329,7 +3335,6 @@ namespace Barotrauma.Networking
serverSettings.SaveClientPermissions();
}
private IEnumerable<object> SendClientPermissionsAfterClientListSynced(Client recipient, Client client)
{
DateTime timeOut = DateTime.Now + new TimeSpan(0, 0, 10);
@@ -3346,7 +3351,6 @@ namespace Barotrauma.Networking
yield return CoroutineStatus.Success;
}
private void SendClientPermissions(Client recipient, Client client)
{
if (recipient?.Connection == null) { return; }