(f2e516dfe) v0.9.3.2
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
const string SavePath = "Data/bannedplayers.txt";
|
||||
|
||||
private List<BannedPlayer> bannedPlayers;
|
||||
private readonly List<BannedPlayer> bannedPlayers;
|
||||
|
||||
public IEnumerable<string> BannedNames
|
||||
{
|
||||
|
||||
@@ -233,11 +233,10 @@ namespace Barotrauma.Networking
|
||||
public static bool CanUseRadio(Character sender, out WifiComponent radio)
|
||||
{
|
||||
radio = null;
|
||||
if (sender == null) { return false; }
|
||||
var senderItem = sender.Inventory.Items.FirstOrDefault(i => i?.GetComponent<WifiComponent>() != null);
|
||||
if (senderItem == null) { return false; }
|
||||
radio = senderItem.GetComponent<WifiComponent>();
|
||||
return sender.HasEquippedItem(senderItem) && radio.CanTransmit();
|
||||
if (sender?.Inventory == null || sender.Removed) { return false; }
|
||||
radio = sender.Inventory.Items.FirstOrDefault(i => i?.GetComponent<WifiComponent>() != null)?.GetComponent<WifiComponent>();
|
||||
if (radio?.Item == null) { return false; }
|
||||
return sender.HasEquippedItem(radio.Item) && radio.CanTransmit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +69,12 @@ namespace Barotrauma.Networking
|
||||
|
||||
public static void LoadAll(string file)
|
||||
{
|
||||
if (!File.Exists(file)) return;
|
||||
if (!File.Exists(file)) { return; }
|
||||
|
||||
XDocument doc = XMLExtensions.TryLoadXml(file);
|
||||
if (doc == null || doc.Root == null) return;
|
||||
if (doc == null || doc.Root == null) { return; }
|
||||
|
||||
List.Clear();
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
List.Add(new PermissionPreset(element));
|
||||
|
||||
@@ -176,9 +176,7 @@ namespace Barotrauma
|
||||
var spawnedEntity = entitySpawnInfo.Spawn();
|
||||
if (spawnedEntity != null)
|
||||
{
|
||||
#if SERVER
|
||||
CreateNetworkEvent(spawnedEntity, false);
|
||||
#endif
|
||||
CreateNetworkEventProjSpecific(spawnedEntity, false);
|
||||
if (spawnedEntity is Item)
|
||||
{
|
||||
((Item)spawnedEntity).Condition = ((ItemSpawnInfo)entitySpawnInfo).Condition;
|
||||
@@ -189,18 +187,17 @@ namespace Barotrauma
|
||||
while (removeQueue.Count > 0)
|
||||
{
|
||||
var removedEntity = removeQueue.Dequeue();
|
||||
|
||||
#if SERVER
|
||||
if (GameMain.Server != null)
|
||||
if (removedEntity is Item item)
|
||||
{
|
||||
CreateNetworkEvent(removedEntity, true);
|
||||
item.SendPendingNetworkUpdates();
|
||||
}
|
||||
#endif
|
||||
|
||||
CreateNetworkEventProjSpecific(removedEntity, true);
|
||||
removedEntity.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
partial void CreateNetworkEventProjSpecific(Entity entity, bool remove);
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
removeQueue.Clear();
|
||||
|
||||
@@ -15,6 +15,9 @@ namespace Barotrauma
|
||||
|
||||
public Dictionary<string, SerializableProperty> SerializableProperties { get; private set; }
|
||||
|
||||
[Serialize(true, true)]
|
||||
public bool ResetKarmaBetweenRounds { get; set; }
|
||||
|
||||
[Serialize(0.1f, true)]
|
||||
public float KarmaDecay { get; set; }
|
||||
|
||||
@@ -75,13 +78,16 @@ namespace Barotrauma
|
||||
|
||||
[Serialize(1.0f, true)]
|
||||
public float KickBanThreshold { get; set; }
|
||||
|
||||
|
||||
[Serialize(0, true)]
|
||||
public int KicksBeforeBan { get; set; }
|
||||
|
||||
[Serialize(10.0f, true)]
|
||||
public float KarmaNotificationInterval { get; set; }
|
||||
|
||||
[Serialize(120.0f, true)]
|
||||
public float AllowedRetaliationTime { get; set; }
|
||||
|
||||
private readonly AfflictionPrefab herpesAffliction;
|
||||
|
||||
public Dictionary<string, XElement> Presets = new Dictionary<string, XElement>();
|
||||
|
||||
@@ -17,7 +17,6 @@ namespace Barotrauma.Networking
|
||||
void Write(Double val);
|
||||
void WriteVariableUInt32(UInt32 val);
|
||||
void Write(string val);
|
||||
void WriteRangedIntegerDeprecated(int min, int max, int val); //TODO: remove this, val should be first parameter >:(
|
||||
void WriteRangedInteger(int val, int min, int max);
|
||||
void WriteRangedSingle(Single val, Single min, Single max, int bitCount);
|
||||
void Write(byte[] val, int startIndex, int length);
|
||||
|
||||
@@ -493,11 +493,6 @@ namespace Barotrauma.Networking
|
||||
MsgWriter.Write(ref buf, ref seekPos, val);
|
||||
}
|
||||
|
||||
public void WriteRangedIntegerDeprecated(int min, int max, int val)
|
||||
{
|
||||
MsgWriter.WriteRangedInteger(ref buf, ref seekPos, val, min, max);
|
||||
}
|
||||
|
||||
public void WriteRangedInteger(int val, int min, int max)
|
||||
{
|
||||
MsgWriter.WriteRangedInteger(ref buf, ref seekPos, val, min, max);
|
||||
@@ -547,7 +542,7 @@ namespace Barotrauma.Networking
|
||||
if (compressedBuf.Length > outBuf.Length) { Array.Resize(ref outBuf, compressedBuf.Length); }
|
||||
Array.Copy(compressedBuf, outBuf, compressedBuf.Length);
|
||||
length = compressedBuf.Length;
|
||||
DebugConsole.NewMessage("Compressed message: " + LengthBytes + " to " + length);
|
||||
DebugConsole.Log("Compressed message: " + LengthBytes + " to " + length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -632,7 +627,7 @@ namespace Barotrauma.Networking
|
||||
buf = new byte[decompressedData.Length];
|
||||
Array.Copy(decompressedData, 0, buf, 0, decompressedData.Length);
|
||||
lengthBits = decompressedData.Length * 8;
|
||||
DebugConsole.NewMessage("Decompressing message: " + inLength + " to " + LengthBytes);
|
||||
DebugConsole.Log("Decompressing message: " + inLength + " to " + LengthBytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -847,10 +842,6 @@ namespace Barotrauma.Networking
|
||||
MsgWriter.Write(ref buf, ref seekPos, val);
|
||||
}
|
||||
|
||||
public void WriteRangedIntegerDeprecated(int min, int max, int val)
|
||||
{
|
||||
MsgWriter.WriteRangedInteger(ref buf, ref seekPos, val, min, max);
|
||||
}
|
||||
|
||||
public void WriteRangedInteger(int val, int min, int max)
|
||||
{
|
||||
|
||||
+2
@@ -13,6 +13,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
public abstract class NetworkConnection
|
||||
{
|
||||
public const double TimeoutThreshold = 60.0; //full minute for timeout because loading screens can take quite a while
|
||||
|
||||
public string Name;
|
||||
|
||||
public UInt64 SteamID
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
public void Heartbeat()
|
||||
{
|
||||
Timeout = 20.0;
|
||||
Timeout = NetworkConnection.TimeoutThreshold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
partial class ServerInfo
|
||||
{
|
||||
public string IP;
|
||||
public string Port;
|
||||
public string ServerName;
|
||||
public string ServerMessage;
|
||||
public bool GameStarted;
|
||||
public int PlayerCount;
|
||||
public int MaxPlayers;
|
||||
public bool HasPassword;
|
||||
|
||||
public bool PingChecked;
|
||||
public int Ping = -1;
|
||||
|
||||
//null value means that the value isn't known (the server may be using
|
||||
//an old version of the game that didn't report these values or the FetchRules query to Steam may not have finished yet)
|
||||
public bool? UsingWhiteList;
|
||||
public SelectionMode? ModeSelectionMode;
|
||||
public SelectionMode? SubSelectionMode;
|
||||
public bool? AllowSpectating;
|
||||
public bool? AllowRespawn;
|
||||
public YesNoMaybe? TraitorsEnabled;
|
||||
public string GameMode;
|
||||
|
||||
public bool? RespondedToSteamQuery = null;
|
||||
|
||||
public string GameVersion;
|
||||
public List<string> ContentPackageNames
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new List<string>();
|
||||
public List<string> ContentPackageHashes
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new List<string>();
|
||||
public List<string> ContentPackageWorkshopUrls
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new List<string>();
|
||||
|
||||
public bool ContentPackagesMatch(IEnumerable<ContentPackage> myContentPackages)
|
||||
{
|
||||
return ContentPackagesMatch(myContentPackages.Select(cp => cp.MD5hash.Hash));
|
||||
}
|
||||
|
||||
public bool ContentPackagesMatch(IEnumerable<string> myContentPackageHashes)
|
||||
{
|
||||
HashSet<string> contentPackageHashes = new HashSet<string>(ContentPackageHashes);
|
||||
return contentPackageHashes.SetEquals(myContentPackageHashes);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user