Add IMove.MoveOntoTarget interface

In `TraitsInterfaces` we expose offset as WPos instead of CPos. In an upcoming PR we'll translate the same change to yaml.
This commit is contained in:
Gustas
2023-01-20 21:29:50 +02:00
committed by Matthias Mailänder
parent ad683d9226
commit dc390a7301
13 changed files with 76 additions and 25 deletions

View File

@@ -132,12 +132,13 @@ namespace OpenRA.Mods.Common.Activities
else if (activeResupplyTypes != 0 && aircraft == null && !isCloseEnough)
{
var targetCell = self.World.Map.CellContaining(host.Actor.CenterPosition);
QueueChild(move.MoveWithinRange(host, closeEnough, targetLineColor: moveInfo.GetTargetLineColor()));
// HACK: Repairable needs the actor to move to host center.
// TODO: Get rid of this or at least replace it with something less hacky.
if (repairableNear == null)
QueueChild(move.MoveTo(targetCell, targetLineColor: moveInfo.GetTargetLineColor()));
QueueChild(move.MoveOntoTarget(self, host, WVec.Zero, null, moveInfo.GetTargetLineColor()));
else
QueueChild(move.MoveWithinRange(host, closeEnough, targetLineColor: moveInfo.GetTargetLineColor()));
var delta = (self.CenterPosition - host.CenterPosition).LengthSquared;
transportCallers.FirstOrDefault(t => t.MinimumDistance.LengthSquared < delta)?.RequestTransport(self, targetCell);