Evaluate exit distance from the exit cell instead of the spawn position.
This commit is contained in:
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
// called on the same exits in the same order!
|
// called on the same exits in the same order!
|
||||||
var all = Exits(actor, productionType)
|
var all = Exits(actor, productionType)
|
||||||
.OrderBy(e => e.Info.Priority)
|
.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();
|
.ToList();
|
||||||
|
|
||||||
return p != null ? all.FirstOrDefault(p) : all.FirstOrDefault();
|
return p != null ? all.FirstOrDefault(p) : all.FirstOrDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user