(6eeea9b7c) v0.9.10.0.0

This commit is contained in:
Joonas Rikkonen
2020-06-04 16:41:07 +03:00
parent ce4ccd99ac
commit eeac247a8e
366 changed files with 7772 additions and 3692 deletions
@@ -416,6 +416,7 @@ namespace Barotrauma
}
}
private List<int> severedJointIndices = new List<int>();
private void WriteStatus(IWriteMessage msg)
{
msg.Write(IsDead);
@@ -426,33 +427,32 @@ namespace Barotrauma
{
msg.Write(CauseOfDeath.Affliction.Identifier);
}
if (AnimController?.LimbJoints == null)
{
//0 limbs severed
msg.Write((byte)0);
}
else
{
List<int> severedJointIndices = new List<int>();
for (int i = 0; i < AnimController.LimbJoints.Length; i++)
{
if (AnimController.LimbJoints[i] != null && AnimController.LimbJoints[i].IsSevered)
{
severedJointIndices.Add(i);
}
}
msg.Write((byte)severedJointIndices.Count);
foreach (int jointIndex in severedJointIndices)
{
msg.Write((byte)jointIndex);
}
}
}
else
{
CharacterHealth.ServerWrite(msg);
}
if (AnimController?.LimbJoints == null)
{
//0 limbs severed
msg.Write((byte)0);
}
else
{
severedJointIndices.Clear();
for (int i = 0; i < AnimController.LimbJoints.Length; i++)
{
if (AnimController.LimbJoints[i] != null && AnimController.LimbJoints[i].IsSevered)
{
severedJointIndices.Add(i);
}
}
msg.Write((byte)severedJointIndices.Count);
foreach (int jointIndex in severedJointIndices)
{
msg.Write((byte)jointIndex);
}
}
}
public void WriteSpawnData(IWriteMessage msg, UInt16 entityId, bool restrictMessageSize)
@@ -7,7 +7,7 @@ using System.ComponentModel;
using FarseerPhysics;
using Barotrauma.Items.Components;
using System.Threading;
using System.IO;
using Barotrauma.IO;
using System.Text;
using System.Diagnostics;
@@ -487,7 +487,7 @@ namespace Barotrauma
if (GameMain.Server == null) return;
if (args.Length < 1)
{
NewMessage("giveperm [id]: Grants administrative permissions to the player with the specified client ID.", Color.Cyan);
NewMessage("giveperm [id/steamid/endpoint/name]: Grants administrative permissions to the player with the specified client.", Color.Cyan);
return;
}
@@ -522,7 +522,7 @@ namespace Barotrauma
if (GameMain.Server == null) return;
if (args.Length < 1)
{
NewMessage("revokeperm [id]: Revokes administrative permissions to the player with the specified client ID.", Color.Cyan);
NewMessage("revokeperm [id/steamid/endpoint/name]: Revokes administrative permissions to the player with the specified client.", Color.Cyan);
return;
}
@@ -604,7 +604,7 @@ namespace Barotrauma
if (GameMain.Server == null) return;
if (args.Length < 1)
{
NewMessage("givecommandperm [id]: Gives the player with the specified client ID the permission to use the specified console commands.", Color.Cyan);
NewMessage("givecommandperm [id/steamid/endpoint/name]: Gives the specified client the permission to use the specified console commands.", Color.Cyan);
return;
}
@@ -615,28 +615,45 @@ namespace Barotrauma
return;
}
ShowQuestionPrompt("Console command permissions to grant to \"" + client.Name + "\"? You may enter multiple commands separated with a space.", (commandsStr) =>
ShowQuestionPrompt("Console command permissions to grant to \"" + client.Name + "\"? You may enter multiple commands separated with a space, or \"all\" to allow using any console command.", (commandsStr) =>
{
string[] splitCommands = commandsStr.Split(' ');
bool giveAll = splitCommands.Length > 0 && splitCommands[0].Equals("all", StringComparison.OrdinalIgnoreCase);
List<Command> grantedCommands = new List<Command>();
for (int i = 0; i < splitCommands.Length; i++)
if (giveAll)
{
splitCommands[i] = splitCommands[i].Trim().ToLowerInvariant();
Command matchingCommand = commands.Find(c => c.names.Contains(splitCommands[i]));
if (matchingCommand == null)
grantedCommands.AddRange(commands);
}
else
{
for (int i = 0; i < splitCommands.Length; i++)
{
ThrowError("Could not find the command \"" + splitCommands[i] + "\"!");
}
else
{
grantedCommands.Add(matchingCommand);
splitCommands[i] = splitCommands[i].Trim().ToLowerInvariant();
Command matchingCommand = commands.Find(c => c.names.Contains(splitCommands[i]));
if (matchingCommand == null)
{
ThrowError("Could not find the command \"" + splitCommands[i] + "\"!");
}
else
{
grantedCommands.Add(matchingCommand);
}
}
}
client.GivePermission(ClientPermissions.ConsoleCommands);
client.SetPermissions(client.Permissions, client.PermittedConsoleCommands.Union(grantedCommands).Distinct().ToList());
GameMain.Server.UpdateClientPermissions(client);
NewMessage("Gave the client \"" + client.Name + "\" the permission to use console commands " + string.Join(", ", grantedCommands.Select(c => c.names[0])) + ".", Color.White);
if (giveAll)
{
NewMessage("Gave the client \"" + client.Name + "\" the permission to use all console commands.", Color.White);
}
else if (grantedCommands.Count > 0)
{
NewMessage("Gave the client \"" + client.Name + "\" the permission to use console commands " + string.Join(", ", grantedCommands.Select(c => c.names[0])) + ".", Color.White);
}
}, args, 1);
});
@@ -645,7 +662,7 @@ namespace Barotrauma
if (GameMain.Server == null) return;
if (args.Length < 1)
{
NewMessage("revokecommandperm [id]: Revokes permission to use the specified console commands from the player with the specified client ID.", Color.Cyan);
NewMessage("revokecommandperm [id/steamid/endpoint/name]: Revokes permission to use the specified console commands from the specified client.", Color.Cyan);
return;
}
@@ -665,23 +682,39 @@ namespace Barotrauma
{
string[] splitCommands = commandsStr.Split(' ');
List<Command> revokedCommands = new List<Command>();
for (int i = 0; i < splitCommands.Length; i++)
bool revokeAll = splitCommands.Length > 0 && splitCommands[0].Equals("all", StringComparison.OrdinalIgnoreCase);
if (revokeAll)
{
splitCommands[i] = splitCommands[i].Trim().ToLowerInvariant();
Command matchingCommand = commands.Find(c => c.names.Contains(splitCommands[i]));
if (matchingCommand == null)
{
ThrowError("Could not find the command \"" + splitCommands[i] + "\"!");
}
else
{
revokedCommands.Add(matchingCommand);
}
revokedCommands.AddRange(commands);
}
else
{
for (int i = 0; i < splitCommands.Length; i++)
{
splitCommands[i] = splitCommands[i].Trim().ToLowerInvariant();
Command matchingCommand = commands.Find(c => c.names.Contains(splitCommands[i]));
if (matchingCommand == null)
{
ThrowError("Could not find the command \"" + splitCommands[i] + "\"!");
}
else
{
revokedCommands.Add(matchingCommand);
}
}
}
client.SetPermissions(client.Permissions, client.PermittedConsoleCommands.Except(revokedCommands).ToList());
GameMain.Server.UpdateClientPermissions(client);
NewMessage("Revoked \"" + client.Name + "\"'s permission to use the console commands " + string.Join(", ", revokedCommands.Select(c => c.names[0])) + ".", Color.White);
if (revokeAll)
{
NewMessage("Revoked \"" + client.Name + "\"'s permission to use console commands.", Color.White);
}
else if (revokedCommands.Any())
{
NewMessage("Revoked \"" + client.Name + "\"'s permission to use the console commands " + string.Join(", ", revokedCommands.Select(c => c.names[0])) + ".", Color.White);
}
}, args, 1);
});
@@ -690,7 +723,7 @@ namespace Barotrauma
if (GameMain.Server == null) return;
if (args.Length < 1)
{
NewMessage("showperm [id]: Shows the current administrative permissions of the client with the specified client ID.", Color.Cyan);
NewMessage("showperm [id/steamid/endpoint/name]: Shows the current administrative permissions of the specified client.", Color.Cyan);
return;
}
@@ -1791,7 +1824,7 @@ namespace Barotrauma
var client = FindClient(args[0]);
if (client == null)
{
ThrowError("Client \"" + args[0] + "\" not found.");
GameMain.Server.SendConsoleMessage("Client \"" + args[0] + "\" not found.", senderClient);
return;
}
if (client.Connection == GameMain.Server.OwnerConnection)
@@ -1800,27 +1833,42 @@ namespace Barotrauma
return;
}
string[] splitCommands = args.Skip(1).ToArray();
List<Command> grantedCommands = new List<Command>();
for (int i = 0; i < splitCommands.Length; i++)
string[] splitCommands = args.Skip(1).ToArray();
bool giveAll = splitCommands.Length > 0 && splitCommands[0].Equals("all", StringComparison.OrdinalIgnoreCase);
if (giveAll)
{
splitCommands[i] = splitCommands[i].Trim().ToLowerInvariant();
Command matchingCommand = commands.Find(c => c.names.Contains(splitCommands[i]));
if (matchingCommand == null)
grantedCommands.AddRange(commands);
}
else
{
for (int i = 0; i < splitCommands.Length; i++)
{
GameMain.Server.SendConsoleMessage("Could not find the command \"" + splitCommands[i] + "\"!", senderClient);
}
else
{
grantedCommands.Add(matchingCommand);
splitCommands[i] = splitCommands[i].Trim().ToLowerInvariant();
Command matchingCommand = commands.Find(c => c.names.Contains(splitCommands[i]));
if (matchingCommand == null)
{
GameMain.Server.SendConsoleMessage("Could not find the command \"" + splitCommands[i] + "\"!", senderClient);
}
else
{
grantedCommands.Add(matchingCommand);
}
}
}
client.GivePermission(ClientPermissions.ConsoleCommands);
client.SetPermissions(client.Permissions, client.PermittedConsoleCommands.Union(grantedCommands).Distinct().ToList());
GameMain.Server.UpdateClientPermissions(client);
GameMain.Server.SendConsoleMessage("Gave the client \"" + client.Name + "\" the permission to use the console commands " + string.Join(", ", grantedCommands.Select(c => c.names[0])) + ".", senderClient);
NewMessage("Gave the client \"" + client.Name + "\" the permission to use the console commands " + string.Join(", ", grantedCommands.Select(c => c.names[0])) + ".", Color.White);
if (giveAll)
{
GameMain.Server.SendConsoleMessage("Gave the client \"" + client.Name + "\" the permission to use all console commands.", senderClient);
}
else if (grantedCommands.Count > 0)
{
GameMain.Server.SendConsoleMessage("Gave the client \"" + client.Name + "\" the permission to use console commands " + string.Join(", ", grantedCommands.Select(c => c.names[0])) + ".", senderClient);
}
}
);
@@ -1828,7 +1876,7 @@ namespace Barotrauma
"revokecommandperm",
(Client senderClient, Vector2 cursorWorldPos, string[] args) =>
{
if (args.Length < 2) return;
if (args.Length < 2) { return; }
var client = FindClient(args[0]);
if (client == null)
@@ -1841,28 +1889,43 @@ namespace Barotrauma
GameMain.Server.SendConsoleMessage("Cannot revoke command permissions from the server owner!", senderClient);
return;
}
string[] splitCommands = args.Skip(1).ToArray();
List<Command> revokedCommands = new List<Command>();
for (int i = 0; i < splitCommands.Length; i++)
string[] splitCommands = args.Skip(1).ToArray();
bool revokeAll = splitCommands.Length > 0 && splitCommands[0].Equals("all", StringComparison.OrdinalIgnoreCase);
if (revokeAll)
{
splitCommands[i] = splitCommands[i].Trim().ToLowerInvariant();
Command matchingCommand = commands.Find(c => c.names.Contains(splitCommands[i]));
if (matchingCommand == null)
revokedCommands.AddRange(commands);
client.RemovePermission(ClientPermissions.ConsoleCommands);
}
else
{
for (int i = 0; i < splitCommands.Length; i++)
{
GameMain.Server.SendConsoleMessage("Could not find the command \"" + splitCommands[i] + "\"!", senderClient);
}
else
{
revokedCommands.Add(matchingCommand);
splitCommands[i] = splitCommands[i].Trim().ToLowerInvariant();
Command matchingCommand = commands.Find(c => c.names.Contains(splitCommands[i]));
if (matchingCommand == null)
{
GameMain.Server.SendConsoleMessage("Could not find the command \"" + splitCommands[i] + "\"!", senderClient);
}
else
{
revokedCommands.Add(matchingCommand);
}
}
client.GivePermission(ClientPermissions.ConsoleCommands);
}
client.GivePermission(ClientPermissions.ConsoleCommands);
client.SetPermissions(client.Permissions, client.PermittedConsoleCommands.Except(revokedCommands).ToList());
GameMain.Server.UpdateClientPermissions(client);
GameMain.Server.SendConsoleMessage("Revoked \"" + client.Name + "\"'s permission to use the console commands " + string.Join(", ", revokedCommands.Select(c => c.names[0])) + ".", senderClient);
NewMessage(senderClient.Name + " revoked \"" + client.Name + "\"'s permission to use the console commands " + string.Join(", ", revokedCommands.Select(c => c.names[0])) + ".", Color.White);
if (revokeAll)
{
GameMain.Server.SendConsoleMessage("Revoked \"" + client.Name + "\"'s permission to use console commands.", senderClient);
}
else if (revokedCommands.Count > 0)
{
GameMain.Server.SendConsoleMessage("Revoked \"" + client.Name + "\"'s permission to use the console commands " + string.Join(", ", revokedCommands.Select(c => c.names[0])) + ".", senderClient);
}
}
);
@@ -1941,6 +2004,27 @@ namespace Barotrauma
}
);
AssignOnClientRequestExecute(
"money",
(Client senderClient, Vector2 cursorWorldPos, string[] args) =>
{
if (args.Length == 0) { return; }
if (!(GameMain.GameSession?.GameMode is MultiPlayerCampaign campaign))
{
GameMain.Server.SendConsoleMessage("No campaign active!", senderClient);
return;
}
if (int.TryParse(args[0], out int money))
{
campaign.Money += money;
campaign.LastUpdateID++;
}
else
{
GameMain.Server.SendConsoleMessage($"\"{args[0]}\" is not a valid numeric value.", senderClient);
}
}
);
AssignOnClientRequestExecute(
"campaigndestination|setcampaigndestination",
(Client senderClient, Vector2 cursorWorldPos, string[] args) =>
@@ -9,7 +9,9 @@ namespace Barotrauma
msg.Write((ushort)items.Count);
foreach (Item item in items)
{
item.WriteSpawnData(msg, item.ID, item.ParentInventory?.Owner?.ID ?? 0);
item.WriteSpawnData(msg,
itemIDs[item],
parentInventoryIDs.ContainsKey(item) ? parentInventoryIDs[item] : Entity.NullEntityID);
}
}
}
@@ -1,4 +1,5 @@
using Barotrauma.Networking;
using System;
using System.Collections.Generic;
namespace Barotrauma
@@ -7,6 +8,9 @@ namespace Barotrauma
{
private bool usedExistingItem;
private UInt16 originalItemID;
private UInt16 originalInventoryID;
private readonly List<Pair<int, int>> executedEffectIndices = new List<Pair<int, int>>();
public override void ServerWriteInitial(IWriteMessage msg, Client c)
@@ -14,11 +18,11 @@ namespace Barotrauma
msg.Write(usedExistingItem);
if (usedExistingItem)
{
msg.Write(item.ID);
msg.Write(originalItemID);
}
else
{
item.WriteSpawnData(msg, item.ID, item.ParentInventory?.Owner?.ID ?? 0);
item.WriteSpawnData(msg, originalItemID, originalInventoryID);
}
msg.Write((byte)executedEffectIndices.Count);
@@ -6,7 +6,7 @@ using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Barotrauma.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
@@ -105,6 +105,8 @@ namespace Barotrauma
MapGenerationParams.Init();
LevelGenerationParams.LoadPresets();
ScriptedEventSet.LoadPrefabs();
Order.Init();
EventManagerSettings.Init();
AfflictionPrefab.LoadAll(GetFilesOfType(ContentType.Afflictions));
SkillSettings.Load(GetFilesOfType(ContentType.SkillSettings));
@@ -180,7 +182,7 @@ namespace Barotrauma
bool enableUpnp = false;
int maxPlayers = 10;
int ownerKey = 0;
int? ownerKey = null;
UInt64 steamId = 0;
XDocument doc = XMLExtensions.TryLoadXml(ServerSettings.SettingsFile);
@@ -197,7 +199,7 @@ namespace Barotrauma
password = doc.Root.GetAttributeString("password", "");
enableUpnp = doc.Root.GetAttributeBool("enableupnp", false);
maxPlayers = doc.Root.GetAttributeInt("maxplayers", 10);
ownerKey = 0;
ownerKey = null;
}
#if DEBUG
@@ -244,7 +246,10 @@ namespace Barotrauma
i++;
break;
case "-ownerkey":
int.TryParse(CommandLineArgs[i + 1], out ownerKey);
if (int.TryParse(CommandLineArgs[i + 1], out int key))
{
ownerKey = key;
}
i++;
break;
case "-steamid":
@@ -1,4 +1,5 @@
using Barotrauma.Networking;
using Barotrauma.IO;
using Barotrauma.Networking;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
@@ -306,7 +307,7 @@ namespace Barotrauma
}
try
{
characterDataDoc.Save(characterDataPath);
characterDataDoc.SaveSafe(characterDataPath);
}
catch (Exception e)
{
@@ -15,7 +15,7 @@ namespace Barotrauma.Items.Components
isOpen = open;
//opening a partially stuck door makes it less stuck
if (isOpen) stuck = MathHelper.Clamp(stuck - 30.0f, 0.0f, 100.0f);
if (isOpen) { stuck = MathHelper.Clamp(stuck - StuckReductionOnOpen, 0.0f, 100.0f); }
if (sendNetworkMessage)
{
@@ -28,6 +28,7 @@ namespace Barotrauma.Items.Components
base.ServerWrite(msg, c, extraData);
msg.Write(isOpen);
msg.Write(isBroken);
msg.Write(extraData.Length == 3 ? (bool)extraData[2] : false); //forced open
msg.WriteRangedSingle(stuck, 0.0f, 100.0f, 8);
msg.Write(lastUser == null ? (UInt16)0 : lastUser.ID);
@@ -13,6 +13,7 @@ namespace Barotrauma.Items.Components
msg.Write(Attached);
msg.Write(body.SimPosition.X);
msg.Write(body.SimPosition.Y);
msg.Write(item.Submarine?.ID ?? Entity.NullEntityID);
}
public void ServerRead(ClientNetObject type, IReadMessage msg, Client c)
@@ -26,7 +27,7 @@ namespace Barotrauma.Items.Components
simPosition = c.Character.SimPosition + offset;
Drop(false, null);
item.SetTransform(simPosition, 0.0f);
item.SetTransform(simPosition, 0.0f, findNewHull: false);
AttachToWall();
item.CreateServerEvent(this);
@@ -6,7 +6,7 @@ namespace Barotrauma.Items.Components
{
public void ServerWrite(IWriteMessage msg, Client c, object[] extraData = null)
{
msg.Write(state);
msg.Write(State);
msg.Write(user == null ? (ushort)0 : user.ID);
}
}
@@ -24,7 +24,7 @@ namespace Barotrauma.Items.Components
}
CustomInterfaceElement clickedButton = null;
if (item.CanClientAccess(c))
if ((c.Character != null && DrawHudWhenEquipped && item.ParentInventory?.Owner == c.Character) || item.CanClientAccess(c))
{
for (int i = 0; i < customInterfaceElementList.Count; i++)
{
@@ -101,6 +101,9 @@ namespace Barotrauma
if (!prevItems.Contains(item) && !item.CanClientAccess(c))
{
#if DEBUG || UNSTABLE
DebugConsole.NewMessage($"Client {c.Name} failed to pick up item \"{item}\" (parent inventory: {(item.ParentInventory?.Owner.ToString() ?? "null")}). No access.", Color.Yellow);
#endif
if (item.body != null && !c.PendingPositionUpdates.Contains(item))
{
c.PendingPositionUpdates.Enqueue(item);
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Barotrauma.IO;
using System.Linq;
using System.Net;
@@ -30,7 +30,8 @@ namespace Barotrauma.Networking
if (orderIndex < 0 || orderIndex >= Order.PrefabList.Count)
{
DebugConsole.ThrowError("Invalid order message from client \"" + c.Name + "\" - order index out of bounds.");
DebugConsole.ThrowError($"Invalid order message from client \"{c.Name}\" - order index out of bounds ({orderIndex}, {orderOptionIndex}).");
if (NetIdUtils.IdMoreRecent(ID, c.LastSentChatMsgID)) { c.LastSentChatMsgID = ID; }
return;
}
@@ -44,7 +45,7 @@ namespace Barotrauma.Networking
txt = msg.ReadString() ?? "";
}
if (!NetIdUtils.IdMoreRecent(ID, c.LastSentChatMsgID)) return;
if (!NetIdUtils.IdMoreRecent(ID, c.LastSentChatMsgID)) { return; }
c.LastSentChatMsgID = ID;
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Barotrauma.IO;
using System.IO.Pipes;
using System.Text;
using System.Threading;
@@ -1,7 +1,7 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using Barotrauma.IO;
using System.Linq;
using System.Threading;
@@ -93,7 +93,7 @@ namespace Barotrauma.Networking
{
data = File.ReadAllBytes(filePath);
}
catch (IOException e)
catch (System.IO.IOException e)
{
if (i >= maxRetries) { throw; }
DebugConsole.NewMessage("Failed to initiate a file transfer {" + e.Message + "}, retrying in 250 ms...", Color.Red);
@@ -8,7 +8,7 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using System.IO.Compression;
using System.IO;
using Barotrauma.IO;
using Barotrauma.Steam;
using System.Xml.Linq;
using System.Threading;
@@ -1917,6 +1917,15 @@ namespace Barotrauma.Networking
var teamID = n == 0 ? Character.TeamType.Team1 : Character.TeamType.Team2;
Submarine.MainSubs[n].TeamID = teamID;
foreach (Item item in Item.ItemList)
{
if (item.Submarine == null) { continue; }
if (item.Submarine != Submarine.MainSubs[n] && !Submarine.MainSubs[n].DockedTo.Contains(item.Submarine)) { continue; }
foreach (WifiComponent wifiComponent in item.GetComponents<WifiComponent>())
{
wifiComponent.TeamID = Submarine.MainSubs[n].TeamID;
}
}
foreach (Submarine sub in Submarine.MainSubs[n].DockedTo)
{
sub.TeamID = teamID;
@@ -344,13 +344,21 @@ namespace Barotrauma.Networking
if (!isCompatibleVersion)
{
RemovePendingClient(pendingClient, DisconnectReason.InvalidVersion,
$"DisconnectMessage.InvalidVersion~[version]={GameMain.Version.ToString()}~[clientversion]={version}");
$"DisconnectMessage.InvalidVersion~[version]={GameMain.Version}~[clientversion]={version}");
GameServer.Log(name + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (incompatible game version)", ServerLog.MessageType.Error);
DebugConsole.NewMessage(name + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (incompatible game version)", Microsoft.Xna.Framework.Color.Red);
return;
}
Client nameTaken = GameMain.Server.ConnectedClients.Find(c => Homoglyphs.Compare(c.Name.ToLower(), name.ToLower()));
if (nameTaken != null)
{
RemovePendingClient(pendingClient, DisconnectReason.NameTaken, "");
GameServer.Log(name + " (" + inc.SenderConnection.RemoteEndPoint.Address + ") couldn't join the server (name too similar to the name of the client \"" + nameTaken.Name + "\").", ServerLog.MessageType.Error);
return;
}
int contentPackageCount = inc.ReadVariableInt32();
List<ClientContentPackage> clientContentPackages = new List<ClientContentPackage>();
for (int i = 0; i < contentPackageCount; i++)
@@ -306,13 +306,21 @@ namespace Barotrauma.Networking
if (!isCompatibleVersion)
{
RemovePendingClient(pendingClient, DisconnectReason.InvalidVersion,
$"DisconnectMessage.InvalidVersion~[version]={GameMain.Version.ToString()}~[clientversion]={version}");
$"DisconnectMessage.InvalidVersion~[version]={GameMain.Version}~[clientversion]={version}");
GameServer.Log(name + " (" + pendingClient.SteamID.ToString() + ") couldn't join the server (incompatible game version)", ServerLog.MessageType.Error);
DebugConsole.NewMessage(name + " (" + pendingClient.SteamID.ToString() + ") couldn't join the server (incompatible game version)", Microsoft.Xna.Framework.Color.Red);
return;
}
Client nameTaken = GameMain.Server.ConnectedClients.Find(c => Homoglyphs.Compare(c.Name.ToLower(), name.ToLower()));
if (nameTaken != null)
{
RemovePendingClient(pendingClient, DisconnectReason.NameTaken, "");
GameServer.Log(name + " (" + pendingClient.SteamID.ToString() + ") couldn't join the server (name too similar to the name of the client \"" + nameTaken.Name + "\").", ServerLog.MessageType.Error);
return;
}
int contentPackageCount = (int)inc.ReadVariableUInt32();
List<ClientContentPackage> clientContentPackages = new List<ClientContentPackage>();
for (int i = 0; i < contentPackageCount; i++)
@@ -1,10 +1,9 @@
using Microsoft.Xna.Framework;
using Barotrauma.IO;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
namespace Barotrauma.Networking
@@ -204,7 +203,7 @@ namespace Barotrauma.Networking
SerializableProperty.SerializeProperties(this, doc.Root, true);
XmlWriterSettings settings = new XmlWriterSettings
System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings
{
Indent = true,
NewLineOnAttributes = true
@@ -212,7 +211,7 @@ namespace Barotrauma.Networking
using (var writer = XmlWriter.Create(SettingsFile, settings))
{
doc.Save(writer);
doc.SaveSafe(writer);
}
if (KarmaPreset == "custom")
@@ -521,13 +520,13 @@ namespace Barotrauma.Networking
try
{
XmlWriterSettings settings = new XmlWriterSettings();
System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
settings.Indent = true;
settings.NewLineOnAttributes = true;
using (var writer = XmlWriter.Create(ClientPermissionsFile, settings))
{
doc.Save(writer);
doc.SaveSafe(writer);
}
}
catch (Exception e)
@@ -1,7 +1,7 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using Barotrauma.IO;
using System.Linq;
using System.Net;
@@ -3,7 +3,7 @@
using Barotrauma.Steam;
using GameAnalyticsSDK.Net;
using System;
using System.IO;
using Barotrauma.IO;
using System.Linq;
using System.Text;
using System.Threading;
@@ -85,8 +85,6 @@ namespace Barotrauma
filePath = Path.GetFileNameWithoutExtension(originalFilePath) + " (" + (existingFiles + 1) + ")" + Path.GetExtension(originalFilePath);
}
StreamWriter sw = new StreamWriter(filePath);
StringBuilder sb = new StringBuilder();
sb.AppendLine("Barotrauma Dedicated Server crash report (generated on " + DateTime.Now + ")");
sb.AppendLine("\n");
@@ -142,8 +140,7 @@ namespace Barotrauma
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(crashReport);
sw.WriteLine(sb.ToString());
sw.Close();
File.WriteAllText(filePath,sb.ToString());
if (GameSettings.SendUserStatistics)
{
@@ -38,7 +38,9 @@ namespace Barotrauma
if (item.Submarine == null)
{
if (!(item.ParentInventory?.Owner is Character)) { continue; }
//items outside the sub don't count as destroyed if they're still in the traitor's inventory
bool carriedByTraitor = Traitors.Any(traitor => item.IsOwnedBy(traitor.Character));
if (!carriedByTraitor) { continue; }
}
else
{
@@ -5,7 +5,7 @@ using System;
using Barotrauma.Networking;
using Lidgren.Network;
using System.Collections.Generic;
using System.IO;
using Barotrauma.IO;
using System.Linq;
using System.Security.Cryptography;
using Barotrauma.Extensions;