Add ignoreActor and checkTransientActors to IPositionable.CanEnterCell

Improved 'return' checks
Removed unnecessary 'using'
Fixed defaults.yaml spelling error
This commit is contained in:
Taryn Hill
2013-10-11 02:46:32 -04:00
parent e9652db486
commit e3e7d0b38c
6 changed files with 30 additions and 14 deletions

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.RA
}
public IEnumerable<Pair<CPos, SubCell>> OccupiedCells() { yield return Pair.New(TopLeft, SubCell.FullCell); }
public bool CanEnterCell(CPos cell)
public bool CanEnterCell(CPos cell, Actor ignoreActor, bool checkTransientActors)
{
if (!self.World.Map.IsInMap(cell.X, cell.Y))
return false;
@@ -60,9 +60,16 @@ namespace OpenRA.Mods.RA
if (!info.AllowedTerrain.Contains(self.World.GetTerrainType(cell)))
return false;
return !self.World.ActorMap.AnyUnitsAt(cell);
if (!checkTransientActors)
return true;
return !self.World.ActorMap.GetUnitsAt(cell)
.Where(x => x != ignoreActor)
.Any();
}
public bool CanEnterCell(CPos cell) { return CanEnterCell(cell, null, true); }
public void SetPosition(Actor self, CPos cell) { SetPosition(self, cell.CenterPosition); }
public void SetVisualPosition(Actor self, WPos pos)
{