Submarine position syncing

This commit is contained in:
Regalis
2016-10-25 20:50:47 +03:00
parent 62dd055e8d
commit df9f89e383
5 changed files with 25 additions and 11 deletions

View File

@@ -1111,6 +1111,10 @@ namespace Barotrauma
public void ServerWrite(NetOutgoingMessage msg, Client c)
{
msg.Write(ID);
//length in bytes
msg.Write((byte)(4 + 4));
msg.Write(PhysicsBody.SimPosition.X);
msg.Write(PhysicsBody.SimPosition.Y);
}
@@ -1119,8 +1123,7 @@ namespace Barotrauma
{
var newTargetPosition = new Vector2(
msg.ReadFloat(),
msg.ReadFloat());
msg.ReadFloat());
//already interpolating with more up-to-date data -> ignore
if (subBody.MemPos.Count > 1 && subBody.MemPos[0].Timestamp > sendingTime)