UnloadCargo rallypoint fixes #2016
This commit is contained in:
committed by
Chris Forbes
parent
6681382819
commit
efe2f2e043
@@ -35,6 +35,19 @@ namespace OpenRA.Mods.RA.Activities
|
||||
return null;
|
||||
}
|
||||
|
||||
CPos? ChooseRallyPoint(Actor self)
|
||||
{
|
||||
var mobile = self.Trait<Mobile>();
|
||||
|
||||
for (var i = -1; i < 2; i++)
|
||||
for (var j = -1; j < 2; j++)
|
||||
if ((i != 0 || j != 0) &&
|
||||
mobile.CanEnterCell(self.Location + new CVec(i, j)))
|
||||
return self.Location + new CVec(i, j);
|
||||
|
||||
return self.Location;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled) return NextActivity;
|
||||
@@ -80,7 +93,10 @@ namespace OpenRA.Mods.RA.Activities
|
||||
actor.CancelActivity();
|
||||
actor.QueueActivity(new Drag(currentPx, exitPx, length));
|
||||
actor.QueueActivity(mobile.MoveTo(exitTile.Value, 0));
|
||||
actor.SetTargetLine(Target.FromCell(exitTile.Value), Color.Green, false);
|
||||
|
||||
var rallyPoint = ChooseRallyPoint(actor).Value;
|
||||
actor.QueueActivity(mobile.MoveTo(rallyPoint, 0));
|
||||
actor.SetTargetLine(Target.FromCell(rallyPoint), Color.Green, false);
|
||||
});
|
||||
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user