From f453980ace2055bd3d233e24566c587b524d1bcd Mon Sep 17 00:00:00 2001 From: juanjp600 Date: Fri, 6 Jan 2017 14:09:06 -0300 Subject: [PATCH] Replaced isStillCountdown with a speed check for server catch-up --- Subsurface/Source/Characters/Character.cs | 27 ++++++----------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index 9bfad4dd8..8bd126ed8 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -45,8 +45,7 @@ namespace Barotrauma } private InputNetFlags dequeuedInput = 0; private InputNetFlags prevDequeuedInput = 0; - - private int isStillCountdown = 5; + private List memInput = new List(); private List memMousePos = new List(); @@ -1359,28 +1358,16 @@ namespace Barotrauma TransformCursorPos(); - if (dequeuedInput == InputNetFlags.None) + if (dequeuedInput == InputNetFlags.None && Math.Abs(AnimController.movement.X) < 0.005f && Math.Abs(AnimController.movement.Y) < 0.005f) { - if (isStillCountdown <= 0) + while (memInput.Count > 5 && memInput[memInput.Count - 1] == 0) { - while (memInput.Count > 5 && memInput[memInput.Count - 1] == 0) - { - //remove inputs where the player is not moving at all - //helps the server catch up, shouldn't affect final position - memInput.RemoveAt(memInput.Count - 1); - memMousePos.RemoveAt(memMousePos.Count - 1); - } - isStillCountdown = 15; - } - else - { - isStillCountdown--; + //remove inputs where the player is not moving at all + //helps the server catch up, shouldn't affect final position + memInput.RemoveAt(memInput.Count - 1); + memMousePos.RemoveAt(memMousePos.Count - 1); } } - else - { - isStillCountdown = 15; - } } } else if (GameMain.Client != null)