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:
committed by
Matthias Mailänder
parent
ad683d9226
commit
dc390a7301
@@ -935,6 +935,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return new Land(self, target);
|
||||
}
|
||||
|
||||
public Activity MoveOntoTarget(Actor self, in Target target, in WVec offset, WAngle? facing, Color? targetLineColor = null)
|
||||
{
|
||||
return new Land(self, target, offset, facing, targetLineColor);
|
||||
}
|
||||
|
||||
public Activity LocalMove(Actor self, WPos fromPos, WPos toPos)
|
||||
{
|
||||
// TODO: Ignore repulsion when moving
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
bool preventDock = false;
|
||||
|
||||
public bool AllowDocking => !preventDock;
|
||||
public CVec DeliveryOffset => info.DockOffset;
|
||||
public WPos DeliveryPosition => self.World.Map.CenterOfCell(self.Location + info.DockOffset);
|
||||
public WAngle DeliveryAngle => info.DockAngle;
|
||||
public bool IsDragRequired => info.IsDragRequired;
|
||||
public WVec DragOffset => info.DragOffset;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor refineryActor)
|
||||
{
|
||||
var iao = refineryActor.Trait<IAcceptResources>();
|
||||
var location = refineryActor.Location + iao.DeliveryOffset;
|
||||
var location = self.World.Map.CellContaining(iao.DeliveryPosition);
|
||||
foreach (var t in transports)
|
||||
t.RequestTransport(self, location);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.Where(r => r.Actor != ignore && r.Actor.Owner == self.Owner && IsAcceptableProcType(r.Actor))
|
||||
.Select(r => new
|
||||
{
|
||||
Location = r.Actor.Location + r.Trait.DeliveryOffset,
|
||||
Location = r.Actor.World.Map.CellContaining(r.Trait.DeliveryPosition),
|
||||
Actor = r.Actor,
|
||||
Occupancy = self.World.ActorsHavingTrait<Harvester>(h => h.LinkedProc == r.Actor).Count()
|
||||
})
|
||||
|
||||
@@ -704,6 +704,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return WrapMove(new LocalMoveIntoTarget(self, target, new WDist(512)));
|
||||
}
|
||||
|
||||
public Activity MoveOntoTarget(Actor self, in Target target, in WVec offset, WAngle? facing, Color? targetLineColor = null)
|
||||
{
|
||||
return WrapMove(new MoveOntoAndTurn(self, target, offset, facing, targetLineColor));
|
||||
}
|
||||
|
||||
public Activity LocalMove(Actor self, WPos fromPos, WPos toPos)
|
||||
{
|
||||
return WrapMove(LocalMove(self, fromPos, toPos, self.Location));
|
||||
|
||||
Reference in New Issue
Block a user