Harvesters will return to ordered-to location if told to harvest a specific cell while full after delivery instead of the last successfully harvested cell which may be far away.

This commit is contained in:
James Dunne
2012-06-29 23:16:07 -05:00
committed by Chris Forbes
parent 3a87b934a6
commit 9a66d7b530

View File

@@ -268,8 +268,9 @@ namespace OpenRA.Mods.RA
LinkProc(self, OwnerLinkedProc = null);
idleSmart = true;
var mobile = self.Trait<Mobile>();
self.CancelActivity();
var mobile = self.Trait<Mobile>();
if (order.TargetLocation != CPos.Zero)
{
var loc = order.TargetLocation;
@@ -295,7 +296,7 @@ namespace OpenRA.Mods.RA
else
{
// A bot order gives us a CPos.Zero TargetLocation, so find some good resources for him:
CPos? loc = FindNextResourceForBot(self);
var loc = FindNextResourceForBot(self);
// No more resources? Oh well.
if (!loc.HasValue)
return;
@@ -306,6 +307,8 @@ namespace OpenRA.Mods.RA
LastOrderLocation = loc;
}
// This prevents harvesters returning to an empty patch when the player orders them to a new patch:
LastHarvestedCell = LastOrderLocation;
self.QueueActivity(new FindResources());
}
else if (order.OrderString == "Deliver")