Evaluate exit distance from the exit cell instead of the spawn position.

This commit is contained in:
Paul Chote
2020-12-01 17:31:40 +00:00
committed by abcdefg30
parent 77ffc20a5f
commit da5c94858f

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
// called on the same exits in the same order!
var all = Exits(actor, productionType)
.OrderBy(e => e.Info.Priority)
.ThenBy(e => (actor.CenterPosition + e.Info.SpawnOffset - pos).Length)
.ThenBy(e => (actor.World.Map.CenterOfCell(actor.Location + e.Info.ExitCell) - pos).LengthSquared)
.ToList();
return p != null ? all.FirstOrDefault(p) : all.FirstOrDefault();