Implementation of the automated D2k Carryall

Closes #2246
This commit is contained in:
Matthijs Benschop
2014-11-20 16:14:29 +01:00
parent 71a8815ffb
commit 2d380c64bd
22 changed files with 681 additions and 21 deletions

View File

@@ -176,7 +176,12 @@ namespace OpenRA.Mods.RA
var territory = self.World.WorldActor.TraitOrDefault<ResourceClaimLayer>();
if (territory != null) territory.ClaimResource(self, moveTo);
self.QueueActivity(new FindResources());
var notify = self.TraitsImplementing<INotifyHarvesterAction>();
var next = new FindResources();
foreach (var n in notify)
n.MovingToResources(self, moveTo, next);
self.QueueActivity(next);
return;
}
}
@@ -302,6 +307,11 @@ namespace OpenRA.Mods.RA
self.QueueActivity(mobile.MoveTo(loc, 0));
self.SetTargetLine(Target.FromCell(self.World, loc), Color.Red);
var notify = self.TraitsImplementing<INotifyHarvesterAction>();
var next = new FindResources();
foreach (var n in notify)
n.MovingToResources(self, loc, next);
LastOrderLocation = loc;
}
else
@@ -341,9 +351,18 @@ namespace OpenRA.Mods.RA
self.CancelActivity();
self.QueueActivity(new DeliverResources());
var notify = self.TraitsImplementing<INotifyHarvesterAction>();
var next = new FindResources();
foreach (var n in notify)
n.MovingToResources(self, order.TargetLocation, next);
}
else if (order.OrderString == "Stop" || order.OrderString == "Move")
{
var notify = self.TraitsImplementing<INotifyHarvesterAction>();
foreach (var n in notify)
n.MovementCancelled(self);
// Turn off idle smarts to obey the stop/move:
idleSmart = false;
}