(b6b2972ea) Fixed linked subs not getting docked correctly when loading a saved game. Closes #1381
This commit is contained in:
@@ -880,8 +880,7 @@ namespace Barotrauma.Items.Components
|
||||
List<MapEntity> linked = new List<MapEntity>(item.linkedTo);
|
||||
foreach (MapEntity entity in linked)
|
||||
{
|
||||
Item linkedItem = entity as Item;
|
||||
if (linkedItem == null) { continue; }
|
||||
if (!(entity is Item linkedItem)) { continue; }
|
||||
|
||||
var dockingPort = linkedItem.GetComponent<DockingPort>();
|
||||
if (dockingPort != null)
|
||||
|
||||
@@ -229,6 +229,8 @@ namespace Barotrauma
|
||||
|
||||
if (myPort != null)
|
||||
{
|
||||
myPort.Undock();
|
||||
|
||||
Vector2 portDiff = myPort.Item.WorldPosition - sub.WorldPosition;
|
||||
Vector2 offset = (myPort.IsHorizontal ?
|
||||
Vector2.UnitX * Math.Sign(linkedPort.Item.WorldPosition.X - myPort.Item.WorldPosition.X) :
|
||||
|
||||
Reference in New Issue
Block a user