Use Mobile.Pathfinder to reduce trait look-ups

This commit is contained in:
reaperrr
2021-02-19 16:59:25 +01:00
committed by Paul Chote
parent 503e706d45
commit 65c796dec7
4 changed files with 4 additions and 9 deletions

View File

@@ -803,12 +803,11 @@ namespace OpenRA.Mods.Common.Traits
if (CanEnterCell(above))
return above;
var pathFinder = self.World.WorldActor.Trait<IPathFinder>();
List<CPos> path;
using (var search = PathSearch.Search(self.World, Locomotor, self, BlockedByActor.All,
loc => loc.Layer == 0 && CanEnterCell(loc))
.FromPoint(self.Location))
path = pathFinder.FindPath(search);
path = Pathfinder.FindPath(search);
if (path.Count > 0)
return path[0];