Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop
This commit is contained in:
@@ -1129,6 +1129,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
//check if midround syncing is needed due to missed unique events
|
||||
if (!midroundSyncingDone) { entityEventManager.InitClientMidRoundSync(c); }
|
||||
MissionAction.NotifyMissionsUnlockedThisRound(c);
|
||||
c.InGame = true;
|
||||
}
|
||||
}
|
||||
@@ -2388,10 +2389,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
List<WayPoint> spawnWaypoints = null;
|
||||
List<WayPoint> mainSubWaypoints = WayPoint.SelectCrewSpawnPoints(characterInfos, Submarine.MainSubs[n]).ToList();
|
||||
if (Level.Loaded?.StartOutpost != null &&
|
||||
Level.Loaded.Type == LevelData.LevelType.Outpost &&
|
||||
(Level.Loaded.StartOutpost.Info.OutpostGenerationParams?.SpawnCrewInsideOutpost ?? false) &&
|
||||
Level.Loaded.StartOutpost.GetConnectedSubs().Any(s => s.Info.Type == SubmarineType.Player))
|
||||
if (Level.Loaded != null && Level.Loaded.ShouldSpawnCrewInsideOutpost())
|
||||
{
|
||||
spawnWaypoints = WayPoint.WayPointList.FindAll(wp =>
|
||||
wp.SpawnType == SpawnType.Human &&
|
||||
@@ -2466,7 +2464,6 @@ namespace Barotrauma.Networking
|
||||
spawnedCharacter.Info.InventoryData = new XElement("inventory");
|
||||
spawnedCharacter.Info.StartItemsGiven = true;
|
||||
spawnedCharacter.SaveInventory();
|
||||
// talents are only avilable for players in online sessions, but modders or someone else might want to have them loaded anyway
|
||||
spawnedCharacter.LoadTalents();
|
||||
}
|
||||
}
|
||||
@@ -3023,7 +3020,7 @@ namespace Barotrauma.Networking
|
||||
client.WaitForNextRoundRespawn = null;
|
||||
client.InGame = false;
|
||||
|
||||
if (client.AccountId is Some<AccountId> { Value: SteamId steamId }) { SteamManager.StopAuthSession(steamId); }
|
||||
if (client.AccountId.TryUnwrap<SteamId>(out var steamId)) { SteamManager.StopAuthSession(steamId); }
|
||||
|
||||
var previousPlayer = previousPlayers.Find(p => p.MatchesClient(client));
|
||||
if (previousPlayer == null)
|
||||
@@ -3366,12 +3363,13 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (checkActiveVote && Voting.ActiveVote != null)
|
||||
{
|
||||
#warning TODO: this is mostly the same as Voting.Update, deduplicate (if/when refactoring the Voting class?)
|
||||
var inGameClients = GameMain.Server.ConnectedClients.Where(c => c.InGame);
|
||||
if (inGameClients.Count() == 1)
|
||||
if (inGameClients.Count() == 1 && inGameClients.First() == Voting.ActiveVote.VoteStarter)
|
||||
{
|
||||
Voting.ActiveVote.Finish(Voting, passed: true);
|
||||
}
|
||||
else
|
||||
else if (inGameClients.Any())
|
||||
{
|
||||
var eligibleClients = inGameClients.Where(c => c != Voting.ActiveVote.VoteStarter);
|
||||
int yes = eligibleClients.Count(c => c.GetVote<int>(Voting.ActiveVote.VoteType) == 2);
|
||||
@@ -3441,12 +3439,11 @@ namespace Barotrauma.Networking
|
||||
|
||||
public void SwitchSubmarine()
|
||||
{
|
||||
if (!(Voting.ActiveVote is Voting.SubmarineVote subVote)) { return; }
|
||||
if (Voting.ActiveVote is not Voting.SubmarineVote subVote) { return; }
|
||||
|
||||
SubmarineInfo targetSubmarine = subVote.Sub;
|
||||
VoteType voteType = Voting.ActiveVote.VoteType;
|
||||
Client starter = Voting.ActiveVote.VoteStarter;
|
||||
int deliveryFee = 0;
|
||||
|
||||
switch (voteType)
|
||||
{
|
||||
@@ -3456,7 +3453,6 @@ namespace Barotrauma.Networking
|
||||
GameMain.GameSession.PurchaseSubmarine(targetSubmarine, starter);
|
||||
break;
|
||||
case VoteType.SwitchSub:
|
||||
deliveryFee = subVote.DeliveryFee;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@@ -3464,7 +3460,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (voteType != VoteType.PurchaseSub)
|
||||
{
|
||||
GameMain.GameSession.SwitchSubmarine(targetSubmarine, subVote.TransferItems, deliveryFee, starter);
|
||||
GameMain.GameSession.SwitchSubmarine(targetSubmarine, subVote.TransferItems, starter);
|
||||
}
|
||||
|
||||
Voting.StopSubmarineVote(true);
|
||||
@@ -4030,8 +4026,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
|
||||
public void Quit()
|
||||
{
|
||||
|
||||
{
|
||||
if (started)
|
||||
{
|
||||
started = false;
|
||||
@@ -4043,7 +4038,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
ServerSettings.SaveSettings();
|
||||
|
||||
ModSender.Dispose();
|
||||
ModSender?.Dispose();
|
||||
|
||||
if (ServerSettings.SaveServerLogs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user