diff --git a/OpenRA.Mods.Common/Traits/Harvester.cs b/OpenRA.Mods.Common/Traits/Harvester.cs index 992f82a261..cf5448112f 100644 --- a/OpenRA.Mods.Common/Traits/Harvester.cs +++ b/OpenRA.Mods.Common/Traits/Harvester.cs @@ -353,12 +353,8 @@ namespace OpenRA.Mods.Common.Traits } else { - // A bot order gives us a CPos.Zero TargetLocation, so find some good resources for him: - loc = FindNextResourceForBot(self); - - // No more resources? Oh well. - if (!loc.HasValue) - return; + // A bot order gives us a CPos.Zero TargetLocation. + loc = self.Location; } var next = new FindResources(self); @@ -411,45 +407,6 @@ namespace OpenRA.Mods.Common.Traits } } - static CPos? FindNextResourceForBot(Actor self) - { - // NOTE: This is only used for the AI to find the next available resource to harvest. - var harvInfo = self.Info.Traits.Get(); - var mobileInfo = self.Info.Traits.Get(); - var resLayer = self.World.WorldActor.Trait(); - var territory = self.World.WorldActor.TraitOrDefault(); - - // Find any harvestable resources: - var path = self.World.WorldActor.Trait().FindPath( - PathSearch.Search(self.World, mobileInfo, self, true, - loc => - { - var resType = resLayer.GetResource(loc); - if (resType == null) - return false; - - // Can the harvester collect this kind of resource? - if (!harvInfo.Resources.Contains(resType.Info.Name)) - return false; - - if (territory != null) - { - // Another harvester has claimed this resource: - ResourceClaim claim; - if (territory.IsClaimedByAnyoneElse(self, loc, out claim)) - return false; - } - - return true; - }) - .FromPoint(self.Location)); - - if (path.Count == 0) - return null; - - return path[0]; - } - public void OnNotifyResourceClaimLost(Actor self, ResourceClaim claim, Actor claimer) { if (self == claimer) return;