Submarine position is synced using the same logic as the characters, AICharacter position syncing

This commit is contained in:
Regalis
2016-10-25 19:01:19 +03:00
parent ac8edb5b2a
commit 07f8c966ab
12 changed files with 234 additions and 256 deletions
+10 -5
View File
@@ -254,10 +254,7 @@ namespace Barotrauma
AnimController.TargetDir = (targetDir) ? Direction.Right : Direction.Left;
AnimController.TargetMovement = targetMovement;
AnimController.MainLimb.body.TargetPosition = pos;
//AnimController.EstimateCurrPosition(pos, (float)(NetTime.Now) - sendingTime);
if (inSub)
{
Hull newHull = Hull.FindHull(ConvertUnits.ToDisplayUnits(pos), AnimController.CurrentHull, false);
@@ -267,7 +264,15 @@ namespace Barotrauma
Submarine = newHull.Submarine;
}
}
int index = 0;
while (index < memPos.Count && sendingTime > memPos[index].Timestamp)
{
index++;
}
memPos.Insert(index, new PosInfo(pos, (targetDir) ? Direction.Right : Direction.Left, sendingTime));
LastNetworkUpdate = sendingTime;
break;
}