Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop
This commit is contained in:
@@ -14,6 +14,16 @@ namespace Barotrauma.Networking
|
||||
public readonly string Reason;
|
||||
public Option<SerializableDateTime> ExpirationTime;
|
||||
public readonly UInt32 UniqueIdentifier;
|
||||
|
||||
public bool MatchesClient(Client client)
|
||||
{
|
||||
if (client == null) { return false; }
|
||||
if (AddressOrAccountId.TryGet(out AccountId bannedAccountId) && client.AccountId.TryUnwrap(out AccountId? accountId))
|
||||
{
|
||||
return bannedAccountId.Equals(accountId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
partial class BanList
|
||||
|
||||
@@ -131,6 +131,7 @@ namespace Barotrauma.Networking
|
||||
catch (AggregateException aggregateException)
|
||||
{
|
||||
if (aggregateException.InnerException is OperationCanceledException) { return Option<int>.None(); }
|
||||
CheckPipeConnected(nameof(readStream), readStream);
|
||||
throw;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
@@ -161,7 +162,18 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (status is StatusEnum.Active && pipe is not { IsConnected: true })
|
||||
{
|
||||
throw new Exception($"{name} was disconnected unexpectedly");
|
||||
string exceptionMsg = $"{name} was disconnected unexpectedly.";
|
||||
#if CLIENT
|
||||
if (Process is { HasExited: true, ExitCode: var exitCode })
|
||||
{
|
||||
exceptionMsg += $" Child process exit code was {(uint)exitCode:X8}.";
|
||||
}
|
||||
else if (Process is { HasExited: false })
|
||||
{
|
||||
exceptionMsg += " Child process has not exited.";
|
||||
}
|
||||
#endif
|
||||
throw new Exception(exceptionMsg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,7 +268,11 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
case ObjectDisposedException _:
|
||||
case System.IO.IOException _:
|
||||
if (!HasShutDown) { throw; }
|
||||
if (!HasShutDown)
|
||||
{
|
||||
CheckPipeConnected(nameof(writeStream), writeStream);
|
||||
throw;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw;
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace Barotrauma.Networking
|
||||
msg.WriteUInt16((UInt16)PermittedConsoleCommands.Count);
|
||||
foreach (DebugConsole.Command command in PermittedConsoleCommands)
|
||||
{
|
||||
msg.WriteString(command.names[0]);
|
||||
msg.WriteIdentifier(command.Names[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,8 +240,8 @@ namespace Barotrauma.Networking
|
||||
UInt16 commandCount = inc.ReadUInt16();
|
||||
for (int i = 0; i < commandCount; i++)
|
||||
{
|
||||
string commandName = inc.ReadString();
|
||||
var consoleCommand = DebugConsole.Commands.Find(c => c.names.Contains(commandName));
|
||||
Identifier commandName = inc.ReadIdentifier();
|
||||
var consoleCommand = DebugConsole.Commands.Find(c => c.Names.Contains(commandName));
|
||||
if (consoleCommand != null)
|
||||
{
|
||||
permittedCommands.Add(consoleCommand);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.Items.Components;
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Steamworks.ServerList;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -111,7 +110,7 @@ namespace Barotrauma
|
||||
|
||||
public void OnSpawned(Entity spawnedItem)
|
||||
{
|
||||
if (!(spawnedItem is Item item)) { throw new ArgumentException($"The entity passed to ItemSpawnInfo.OnSpawned must be an Item (value was {spawnedItem?.ToString() ?? "null"})."); }
|
||||
if (spawnedItem is not Item item) { throw new ArgumentException($"The entity passed to ItemSpawnInfo.OnSpawned must be an Item (value was {spawnedItem?.ToString() ?? "null"})."); }
|
||||
onSpawned?.Invoke(item);
|
||||
}
|
||||
}
|
||||
@@ -443,6 +442,7 @@ namespace Barotrauma
|
||||
CreateNetworkEventProjSpecific(new SpawnEntity(spawnedEntity));
|
||||
}
|
||||
spawnInfo.OnSpawned(spawnedEntity);
|
||||
GameMain.GameSession?.EventManager?.EntitySpawned(spawnedEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace Barotrauma.Networking
|
||||
int orderPriority = msg.ReadByte();
|
||||
OrderTarget orderTargetPosition = null;
|
||||
Order.OrderTargetType orderTargetType = (Order.OrderTargetType)msg.ReadByte();
|
||||
int wallSectionIndex = 0;
|
||||
int? wallSectionIndex = null;
|
||||
if (msg.ReadBoolean())
|
||||
{
|
||||
float x = msg.ReadSingle();
|
||||
|
||||
@@ -268,6 +268,13 @@ namespace Barotrauma.Networking
|
||||
continue;
|
||||
}
|
||||
|
||||
#if CLIENT
|
||||
foreach (var itemComponent in item.Components)
|
||||
{
|
||||
itemComponent.StopLoopingSound();
|
||||
}
|
||||
#endif
|
||||
|
||||
//restore other items to full condition and recharge batteries
|
||||
item.Condition = item.MaxCondition;
|
||||
item.GetComponent<Repairable>()?.ResetDeterioration();
|
||||
|
||||
@@ -648,6 +648,13 @@ namespace Barotrauma.Networking
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(true, IsPropertySaveable.Yes)]
|
||||
public bool AllowImmediateItemDelivery
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(false, IsPropertySaveable.Yes)]
|
||||
public bool LockAllDefaultWires
|
||||
{
|
||||
@@ -845,6 +852,13 @@ namespace Barotrauma.Networking
|
||||
private set;
|
||||
}
|
||||
|
||||
[Serialize(10.0f, IsPropertySaveable.Yes)]
|
||||
public float MinimumMidRoundSyncTimeout
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
private bool karmaEnabled;
|
||||
[Serialize(false, IsPropertySaveable.Yes)]
|
||||
public bool KarmaEnabled
|
||||
|
||||
Reference in New Issue
Block a user