Skip to content

Commit 175ba53

Browse files
committed
Improve controller interaction
1 parent 0b29e5e commit 175ba53

File tree

1 file changed

+9
-5
lines changed
  • Data/Base.rte/Scenes/Objects/Bunkers/BunkerSystems/Automovers/Controller

1 file changed

+9
-5
lines changed

Data/Base.rte/Scenes/Objects/Bunkers/BunkerSystems/Automovers/Controller/Controller.lua

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -914,8 +914,8 @@ automoverActorFunctions.addActorToAutomoverTable = function(self, actor)
914914
actor:SetNumberValue("Automover_OldMoveProximityLimit", actor.MoveProximityLimit);
915915
end
916916

917-
-- Make move proximity much lower so we don't get caught on corners
918-
actor.MoveProximityLimit = 2;
917+
-- Make move proximity much higher so we don't zigzag back and forth
918+
actor.MoveProximityLimit = 5;
919919

920920
self.affectedActorsCount = self.affectedActorsCount + 1;
921921

@@ -1127,9 +1127,9 @@ automoverActorFunctions.updateDirectionsFromActorControllerInput = function(self
11271127

11281128
analogMove = wptPos - actor.Pos;
11291129

1130-
-- the ai only removes points if it's not flying and moving, so let's remove the point if needed
1131-
if analogMove:MagnitudeIsLessThan(3) then
1132-
actor:RemoveMovePathBeginning();
1130+
-- zero out the axis we're being centred on, if we're only being centred on one
1131+
if actorData.centeringAxes ~= nil and #actorData.centeringAxes == 1 then
1132+
analogMove[actorData.centeringAxes[1]] = 0;
11331133
end
11341134

11351135
analogMove:Normalize();
@@ -1540,6 +1540,8 @@ automoverActorFunctions.centreActorToClosestNodeIfMovingInAppropriateDirection =
15401540
local actor = actorData.actor;
15411541
local actorDirection = actorData.direction;
15421542

1543+
actorData.centeringAxes = {};
1544+
15431545
local oldClosestNode = actorData.currentClosestNode;
15441546
local closestNode = self:findClosestNode(actor.Pos, actorData.currentClosestNode, true, true) or actorData.currentClosestNode;
15451547
actorData.currentClosestNode = closestNode;
@@ -1577,6 +1579,8 @@ automoverActorFunctions.centreActorToClosestNodeIfMovingInAppropriateDirection =
15771579
else
15781580
centeringAxes = { (directionToUseForCentering == Directions.Up or directionToUseForCentering == Directions.Down) and "X" or "Y"; }
15791581
end
1582+
actorData.centeringAxes = centeringAxes;
1583+
15801584
local gravityAdjustment = SceneMan.GlobalAcc * TimerMan.DeltaTimeSecs * -1;
15811585
local centeringSpeedAndDistance = self.movementAcceleration * 5;
15821586

0 commit comments

Comments
 (0)