Skip to content

Commit 6bdadfc

Browse files
committed
fix dropships not delivering where they spawned
1 parent f4522eb commit 6bdadfc

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

Data/Base.rte/AI/NativeDropShipAI.lua

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function NativeDropShipAI:Update(Owner)
8989
elseif Owner.AIMode == Actor.AIMODE_SENTRY then
9090
self.Waypoint = Owner.Pos;
9191
self.DeliveryState = ACraft.STANDBY;
92-
else
92+
else -- Deliver, most likely
9393
local FuturePos = Owner.Pos + Owner.Vel*20;
9494

9595
-- Make sure FuturePos is inside the scene
@@ -107,22 +107,16 @@ function NativeDropShipAI:Update(Owner)
107107
end
108108
end
109109

110-
-- Use GetLastAIWaypoint() as a LZ so the AI can give orders to dropships
111-
local Wpt = Owner:GetLastAIWaypoint();
112-
if (Owner.Pos - Wpt).Largest > 1 then
113-
self.Waypoint = Wpt;
110+
local startingHeight;
111+
if SceneMan.SceneOrbitDirection == 0 then
112+
startingHeight = hoverHeightModifierChanged and Owner.Radius * 1.25 or math.max(Owner.Radius * 1.25, Owner.Pos.Y);
114113
else
115-
local startingHeight;
116-
if SceneMan.SceneOrbitDirection == 0 then
117-
startingHeight = hoverHeightModifierChanged and Owner.Radius * 1.25 or math.max(Owner.Radius * 1.25, Owner.Pos.Y);
118-
else
119-
startingHeight = Owner.Pos.Y;
120-
end
121-
local WptL = SceneMan:MovePointToGround(Vector(-Owner.Radius, startingHeight), self.hoverAlt, 12);
122-
local WptC = SceneMan:MovePointToGround(Vector(0, startingHeight), self.hoverAlt, 12);
123-
local WptR = SceneMan:MovePointToGround(Vector(Owner.Radius, startingHeight), self.hoverAlt, 12);
124-
self.Waypoint = Vector(Owner.Pos.X, math.min(WptL.Y, WptC.Y, WptR.Y));
114+
startingHeight = Owner.Pos.Y;
125115
end
116+
local WptL = SceneMan:MovePointToGround(Vector(-Owner.Radius, startingHeight), self.hoverAlt, 12);
117+
local WptC = SceneMan:MovePointToGround(Vector(0, startingHeight), self.hoverAlt, 12);
118+
local WptR = SceneMan:MovePointToGround(Vector(Owner.Radius, startingHeight), self.hoverAlt, 12);
119+
self.Waypoint = Vector(Owner.Pos.X, math.min(WptL.Y, WptC.Y, WptR.Y));
126120

127121
self.DeliveryState = ACraft.FALL;
128122
end

0 commit comments

Comments
 (0)