1
+ require (" Utilities" );
1
2
require (" Scenes/Objects/Bunkers/BunkerSystems/Automovers/GlobalAutomoverFunctions" );
2
3
3
4
local automoverUtilityFunctions = {};
@@ -678,7 +679,7 @@ automoverUtilityFunctions.findClosestNode = function(self, positionToFindClosest
678
679
return closestNode ;
679
680
end
680
681
681
- automoverUtilityFunctions .findNodeWithShortestScenePath = function (self , positionToFindClosestNodeFor , nodeThatMustHaveConnectingAutomoverPath , checkThatPositionIsInsideNodeZoneBoxOrConnectingAreas , pathfinderTeam , pathfinderDigStrength )
682
+ automoverUtilityFunctions .findNodeWithShortestScenePath = function (self , positionToFindClosestNodeFor , nodeToCheckForPathsFrom , checkThatPositionIsInsideNodeZoneBoxOrConnectingAreas , pathfinderTeam , pathfinderDigStrength )
682
683
local teamNodeTable = AutomoverData [self .Team ].nodeData ;
683
684
local teamTeleporterTable = AutomoverData [self .Team ].teleporterNodes ;
684
685
@@ -690,6 +691,7 @@ automoverUtilityFunctions.findNodeWithShortestScenePath = function(self, positio
690
691
nodeSatisfiesConditions = nodeData .zoneBox :IsWithinBox (positionToFindClosestNodeFor );
691
692
if not nodeSatisfiesConditions then
692
693
local connectingAreaDirectionToCheck = Directions .None ;
694
+ local distanceToNode = SceneMan :ShortestDistance (node .Pos , positionToFindClosestNodeFor , self .checkWrapping );
693
695
if distanceToNode .Y + (nodeData .size .Y * 0.5 ) < 0 then
694
696
connectingAreaDirectionToCheck = Directions .Up ;
695
697
elseif distanceToNode .Y - (nodeData .size .Y * 0.5 ) > 0 then
@@ -713,7 +715,7 @@ automoverUtilityFunctions.findNodeWithShortestScenePath = function(self, positio
713
715
while coroutine.status (shortestPathCoroutine ) ~= " dead" do
714
716
local _ , result = coroutine.resume (shortestPathCoroutine , potentialClosestNodes , positionToFindClosestNodeFor , pathfinderTeam , false , pathfinderDigStrength );
715
717
if result then
716
- return result . key ;
718
+ return result ;
717
719
else
718
720
coroutine.yield ();
719
721
end
0 commit comments