Fix Locomotor CellCache to not consider transit only cells as crushable.
When the UpdateCellBlocking encountered a transit-only cell (the bibs around a building) it would bail from the loop. This would leave the cellCrushablePlayers set to all players. It would update the cell cache and mark that cell as a crushable location. When CanMoveFreelyInto would later evaluate a cell, it would consider it passable because the crushable check would pass (cellCache.Crushable.Overlaps(actor.Owner.PlayerMask)) rather than because the transit check (otherActor.OccupiesSpace is Building building && building.TransitOnlyCells().Contains(cell)) would pass. Although this meant the cell was treated as passable in either scenario, it means the cache contained incorrect data. The cell does not contain any crushable actors but the cache would indicate it did. Correcting this means we can rely on the crushability information stored in the cache to be accurate.
This commit is contained in:
committed by
Matthias Mailänder
parent
77779023d5
commit
7e7d94ca89
@@ -252,8 +252,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (check <= BlockedByActor.Immovable && !cellCache.Immovable.Overlaps(actor.Owner.PlayerMask))
|
if (check <= BlockedByActor.Immovable && !cellCache.Immovable.Overlaps(actor.Owner.PlayerMask))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Cache doesn't account for ignored actors, temporary blockers, or subcells - these must use the slow path.
|
// Cache doesn't account for ignored actors, subcells, temporary blockers or transit only actors.
|
||||||
if (ignoreActor == null && !cellFlag.HasCellFlag(CellFlag.HasTemporaryBlocker) && subCell == SubCell.FullCell)
|
// These must use the slow path.
|
||||||
|
if (ignoreActor == null && subCell == SubCell.FullCell &&
|
||||||
|
!cellFlag.HasCellFlag(CellFlag.HasTemporaryBlocker) && !cellFlag.HasCellFlag(CellFlag.HasTransitOnlyActor))
|
||||||
{
|
{
|
||||||
// We already know there are uncrushable actors in the cell so we are always blocked.
|
// We already know there are uncrushable actors in the cell so we are always blocked.
|
||||||
if (check == BlockedByActor.All)
|
if (check == BlockedByActor.All)
|
||||||
@@ -485,10 +487,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var isTransitOnly = actor.OccupiesSpace is Building building && building.TransitOnlyCells().Contains(cell);
|
var isTransitOnly = actor.OccupiesSpace is Building building && building.TransitOnlyCells().Contains(cell);
|
||||||
|
|
||||||
if (isTransitOnly)
|
if (isTransitOnly)
|
||||||
{
|
|
||||||
cellFlag |= CellFlag.HasTransitOnlyActor;
|
cellFlag |= CellFlag.HasTransitOnlyActor;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (crushables.Any())
|
if (crushables.Any())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user