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
+16 -1
View File
@@ -93,13 +93,28 @@ namespace Barotrauma
dictionary.Add(id, this);
}
/// <summary>
/// Writes the state of the entity into the message
/// </summary>
/// <param name="data">some data that was saved when the networkevent was created</param>
/// <returns>false if something went wrong when filling the message, true if the msg is ready to be sent</returns>
public virtual bool FillNetworkData(NetworkEventType type, NetBuffer message, object data)
{
return false;
}
public virtual void ReadNetworkData(NetworkEventType type, NetIncomingMessage message, float sendingTime, out object data)
/// <summary>
/// Updates the state of the entity based on the data in the message
/// </summary>
/// <param name="sendingTime"></param>
/// <param name="data"></param>
/// <returns>false if the message is not valid (client trying to change something they're not authorized to, corrupt data, etc) and should be ignored</returns>
public virtual bool ReadNetworkData(NetworkEventType type, NetIncomingMessage message, float sendingTime, out object data)
{
data = null;
return false;
}
/// <summary>