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

@@ -131,10 +131,10 @@ namespace OpenRA.Mods.Common.Activities
var lastproc = harv.LastLinkedProc ?? harv.LinkedProc;
if (lastproc != null && !lastproc.Disposed)
{
var deliveryLoc = lastproc.Location + lastproc.Trait<IAcceptResources>().DeliveryOffset;
if (self.Location == deliveryLoc && harv.IsEmpty)
var deliveryLoc = lastproc.Trait<IAcceptResources>().DeliveryPosition;
if (self.CenterPosition == deliveryLoc && harv.IsEmpty)
{
var unblockCell = deliveryLoc + harv.Info.UnblockCell;
var unblockCell = self.World.Map.CellContaining(deliveryLoc) + harv.Info.UnblockCell;
var moveTo = mobile.NearestMoveableCell(unblockCell, 1, 5);
QueueChild(mobile.MoveTo(moveTo, 1));
}
@@ -246,10 +246,10 @@ namespace OpenRA.Mods.Common.Activities
CPos? GetSearchFromProcLocation()
{
if (harv.LastLinkedProc != null && !harv.LastLinkedProc.IsDead && harv.LastLinkedProc.IsInWorld)
return harv.LastLinkedProc.Location + harv.LastLinkedProc.Trait<IAcceptResources>().DeliveryOffset;
return harv.LastLinkedProc.World.Map.CellContaining(harv.LastLinkedProc.Trait<IAcceptResources>().DeliveryPosition);
if (harv.LinkedProc != null && !harv.LinkedProc.IsDead && harv.LinkedProc.IsInWorld)
return harv.LinkedProc.Location + harv.LinkedProc.Trait<IAcceptResources>().DeliveryOffset;
return harv.LinkedProc.World.Map.CellContaining(harv.LinkedProc.Trait<IAcceptResources>().DeliveryPosition);
return null;
}