From 9a66d7b5305c8e26d06e9f43ad568307f4268edf Mon Sep 17 00:00:00 2001 From: James Dunne Date: Fri, 29 Jun 2012 23:16:07 -0500 Subject: [PATCH] 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. --- OpenRA.Mods.RA/Harvester.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.RA/Harvester.cs b/OpenRA.Mods.RA/Harvester.cs index f646fd7867..a0633791a1 100644 --- a/OpenRA.Mods.RA/Harvester.cs +++ b/OpenRA.Mods.RA/Harvester.cs @@ -268,8 +268,9 @@ namespace OpenRA.Mods.RA LinkProc(self, OwnerLinkedProc = null); idleSmart = true; - var mobile = self.Trait(); self.CancelActivity(); + + var mobile = self.Trait(); 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")