Fixed client-side docking ports creating duplicate bodies on doors, causing characters to collide with an invisible door when trying to move between docked subs (until the server forces them through it). + TODO note about bugged hull finding logic in UpdateNetPlayerPosition!

This commit is contained in:
Joonas Rikkonen
2018-11-10 20:21:43 +02:00
parent 481f51f3d8
commit cea5d5b074
2 changed files with 9 additions and 0 deletions

View File

@@ -1497,6 +1497,7 @@ namespace Barotrauma
}
}
//TODO: this does not work, the positions are in sim units but FindHull uses display units
Hull serverHull = Hull.FindHull(serverPos.Position, character.CurrentHull, false);
Hull clientHull = Hull.FindHull(localPos.Position, serverHull, false);

View File

@@ -335,6 +335,12 @@ namespace Barotrauma.Items.Components
private void CreateDoorBody()
{
if (doorBody != null)
{
GameMain.World.RemoveBody(doorBody);
doorBody = null;
}
Vector2 position = ConvertUnits.ToSimUnits(item.Position + (dockingTarget.door.Item.WorldPosition - item.WorldPosition));
if (!MathUtils.IsValid(position))
{
@@ -351,6 +357,8 @@ namespace Barotrauma.Items.Components
position = Vector2.Zero;
}
System.Diagnostics.Debug.Assert(doorBody == null);
doorBody = BodyFactory.CreateRectangle(GameMain.World,
dockingTarget.door.Body.width,
dockingTarget.door.Body.height,