Release 1.8.7.0 - Calm Before the Storm Hotfix 1

This commit is contained in:
Regalis11
2025-04-16 12:46:39 +03:00
parent 38cce0c933
commit 1deef20f21
20 changed files with 103 additions and 53 deletions
@@ -89,19 +89,10 @@ namespace Barotrauma.Items.Components
#endif
if (autoPilot)
{
if (pathFinder == null)
{
pathFinder = new PathFinder(WayPoint.WayPointList, false)
{
GetNodePenalty = GetNodePenalty
};
}
MaintainPos = true;
if (posToMaintain == null)
{
posToMaintain = controlledSub != null ?
controlledSub.WorldPosition :
item.Submarine == null ? item.WorldPosition : item.Submarine.WorldPosition;
RefreshPosToMaintain();
}
}
else
@@ -266,6 +257,24 @@ namespace Barotrauma.Items.Components
return true;
}
/// <summary>
/// Sets the position the autopilot tries to maintain to the current position of the sub.
/// </summary>
public void RefreshPosToMaintain()
{
posToMaintain = controlledSub != null ?
controlledSub.WorldPosition :
item.Submarine == null ? item.WorldPosition : item.Submarine.WorldPosition;
}
public override void OnMapLoaded()
{
if (MaintainPos)
{
RefreshPosToMaintain();
}
}
public override void Update(float deltaTime, Camera cam)
{
if (!searchedConnectedDockingPort)
@@ -628,7 +637,10 @@ namespace Barotrauma.Items.Components
if (pathFinder == null)
{
pathFinder = new PathFinder(WayPoint.WayPointList, false);
pathFinder = new PathFinder(WayPoint.WayPointList, false)
{
GetNodePenalty = GetNodePenalty
};
}
Vector2 target;