More security checks
This actually looks pretty bad, not gonna lie.
This commit is contained in:
@@ -1702,7 +1702,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
data = null;
|
data = null;
|
||||||
|
|
||||||
if (GameMain.Server != null && type != NetworkEventType.InventoryUpdate)
|
if (GameMain.Server != null && (type != NetworkEventType.InventoryUpdate || (!IsUnconscious && !IsDead)))
|
||||||
{
|
{
|
||||||
Client sender = GameMain.Server.ConnectedClients.Find(c => c.Connection == message.SenderConnection);
|
Client sender = GameMain.Server.ConnectedClients.Find(c => c.Connection == message.SenderConnection);
|
||||||
if (sender == null || sender.Character != this)
|
if (sender == null || sender.Character != this)
|
||||||
|
|||||||
@@ -487,6 +487,10 @@ namespace Barotrauma.Items.Components
|
|||||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message, float sendingTime)
|
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message, float sendingTime)
|
||||||
{
|
{
|
||||||
if (sendingTime < lastReceivedMessage) return;
|
if (sendingTime < lastReceivedMessage) return;
|
||||||
|
if (GameMain.Server != null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
lastReceivedMessage = sendingTime;
|
lastReceivedMessage = sendingTime;
|
||||||
|
|
||||||
|
|||||||
@@ -1732,13 +1732,22 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Drop(sender.Character, false);
|
||||||
|
if (body != null)
|
||||||
|
{
|
||||||
|
body.TargetPosition = sender.Character.SimPosition;
|
||||||
|
body.MoveToTargetPosition();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
Drop(null, false);
|
|
||||||
if (body != null)
|
|
||||||
{
|
{
|
||||||
body.ReadNetworkData(message, sendingTime);
|
//client should not tell the server where the item should drop
|
||||||
body.MoveToTargetPosition();
|
Drop(null, false);
|
||||||
|
if (body != null)
|
||||||
|
{
|
||||||
|
body.ReadNetworkData(message, sendingTime);
|
||||||
|
body.MoveToTargetPosition();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NetworkEventType.PhysicsBodyPosition:
|
case NetworkEventType.PhysicsBodyPosition:
|
||||||
|
|||||||
@@ -395,6 +395,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void ReadNetworkData(NetIncomingMessage message, float sendingTime)
|
public void ReadNetworkData(NetIncomingMessage message, float sendingTime)
|
||||||
{
|
{
|
||||||
|
if (GameMain.Server != null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (sendingTime < lastNetworkUpdateTime) return;
|
if (sendingTime < lastNetworkUpdateTime) return;
|
||||||
|
|
||||||
Vector2 newTargetPos = Vector2.Zero;
|
Vector2 newTargetPos = Vector2.Zero;
|
||||||
|
|||||||
Reference in New Issue
Block a user