Generalize RallyPointInfo.Offset to support arbitrary length paths.

This commit is contained in:
Paul Chote
2020-02-09 15:30:14 +00:00
committed by abcdefg30
parent 9dc4ea8541
commit b2f0ac15e8
16 changed files with 80 additions and 25 deletions

View File

@@ -79,8 +79,21 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Query or set a factory's rally point.")]
public CPos RallyPoint
{
get { return rp.Path.Last(); }
set { rp.Path = new List<CPos> { value }; }
get
{
if (rp.Path.Count > 0)
return rp.Path.Last();
var exit = Self.FirstExitOrDefault();
if (exit != null)
return Self.Location + exit.Info.ExitCell;
return Self.Location;
}
set
{
rp.Path = new List<CPos> { value };
}
}
}