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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user