More sanity checks to make sure clients aren't doing something they're not allowed to:

- AICharacter, hull, structure and submarine updates from clients are ignored
- character updates from anyone else than the client controlling the character are ignored
- players can't pick/drop items from anyone else's inventory (unless the target is unconscious/stunned/cuffed)
- server has authority over reactor temperature
This commit is contained in:
Regalis
2016-08-16 17:56:33 +03:00
parent 8a2ad8eb64
commit 6c5452570e
11 changed files with 175 additions and 106 deletions
+7 -5
View File
@@ -831,11 +831,13 @@ namespace Barotrauma
return true;
}
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message, float sendingTime, out object data)
public override bool ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message, float sendingTime, out object data)
{
data = null;
if (sendingTime < lastNetworkUpdate) return;
if (GameMain.Server != null) return false;
if (sendingTime < lastNetworkUpdate) return false;
float newVolume = this.volume;
float newOxygen = this.OxygenPercentage;
@@ -851,7 +853,7 @@ namespace Barotrauma
catch (Exception e)
{
DebugConsole.Log("Failed to read network message for Hull {" + ID + "}! " + e.Message);
return;
return false;
}
Volume = newVolume;
@@ -901,8 +903,6 @@ namespace Barotrauma
}
}
var toBeRemoved = fireSources.FindAll(fs => !newFireSources.Contains(fs));
for (int i = toBeRemoved.Count - 1; i >= 0; i--)
{
@@ -911,6 +911,8 @@ namespace Barotrauma
fireSources = newFireSources;
lastNetworkUpdate = sendingTime;
return true;
}