diff --git a/OpenRA.Mods.Common/Activities/FindResources.cs b/OpenRA.Mods.Common/Activities/FindResources.cs index 49205a5997..55fce8ca29 100644 --- a/OpenRA.Mods.Common/Activities/FindResources.cs +++ b/OpenRA.Mods.Common/Activities/FindResources.cs @@ -27,6 +27,7 @@ namespace OpenRA.Mods.Common.Activities readonly ResourceLayer resLayer; readonly ResourceClaimLayer territory; readonly IPathFinder pathFinder; + readonly DomainIndex domainIndex; CPos? avoidCell; @@ -39,6 +40,7 @@ namespace OpenRA.Mods.Common.Activities resLayer = self.World.WorldActor.Trait(); territory = self.World.WorldActor.TraitOrDefault(); pathFinder = self.World.WorldActor.Trait(); + domainIndex = self.World.WorldActor.Trait(); } public FindResources(Actor self, CPos avoidCell) @@ -142,8 +144,9 @@ namespace OpenRA.Mods.Common.Activities var searchRadius = harv.LastOrderLocation.HasValue ? harvInfo.SearchFromOrderRadius : harvInfo.SearchFromProcRadius; var searchRadiusSquared = searchRadius * searchRadius; + var passable = (uint)mobileInfo.GetMovementClass(self.World.TileSet); var search = PathSearch.Search(self.World, mobileInfo, self, true, - loc => IsHarvestable(self, loc)) + loc => domainIndex.IsPassable(self.Location, loc, passable) && IsHarvestable(self, loc)) .WithCustomCost(loc => { if ((avoidCell.HasValue && loc == avoidCell.Value) ||