Add a subCell parameter to IPositionableInfo.CanEnterCell

This commit is contained in:
abcdefg30
2019-10-12 12:07:02 +02:00
committed by teinarss
parent 980c1e1b6a
commit 4717e98c48
8 changed files with 19 additions and 14 deletions

View File

@@ -246,6 +246,11 @@ namespace OpenRA.Mods.Common.Traits
// Determines whether the actor is blocked by other Actors
public bool CanMoveFreelyInto(Actor actor, CPos cell, BlockedByActor check, Actor ignoreActor)
{
return CanMoveFreelyInto(actor, cell, SubCell.FullCell, check, ignoreActor);
}
public bool CanMoveFreelyInto(Actor actor, CPos cell, SubCell subCell, BlockedByActor check, Actor ignoreActor)
{
var cellCache = GetCache(cell);
var cellFlag = cellCache.CellFlag;
@@ -296,7 +301,8 @@ namespace OpenRA.Mods.Common.Traits
return false;
}
foreach (var otherActor in world.ActorMap.GetActorsAt(cell))
var otherActors = subCell == SubCell.FullCell ? world.ActorMap.GetActorsAt(cell) : world.ActorMap.GetActorsAt(cell, subCell);
foreach (var otherActor in otherActors)
if (IsBlockedBy(actor, otherActor, ignoreActor, check, cellFlag))
return false;