Fix Locomotor IsMoving checks.
The Locomotor IsMoving check was allowing us to consider another actor that moving as not a blocker. However for some reason it also considered the actor trying to path being mobile as sufficient for this check to pass which did not make sense. We remove that extra check and inline the method.
This was a regression from 4a609bbee8 which changed the method from IsMovingInMyDirection (which required the lookup of the mobile trait) to just IsMoving. It should have removed the lookup as not required.
This fixes a crash in HPF which was considered the location as blocked when Locomotor considered it unblocked because the logic was not aligned. Removing this check aligns the logic and resolves the crash.
This commit is contained in:
@@ -335,7 +335,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
// If the check allows: we are not blocked by moving units.
|
// If the check allows: we are not blocked by moving units.
|
||||||
if (check <= BlockedByActor.Stationary && cellFlag.HasCellFlag(CellFlag.HasMovingActor) &&
|
if (check <= BlockedByActor.Stationary && cellFlag.HasCellFlag(CellFlag.HasMovingActor) &&
|
||||||
IsMoving(actor, otherActor))
|
otherActor.OccupiesSpace is Mobile otherMobile && otherMobile.CurrentMovementTypes.HasMovementType(MovementType.Horizontal))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (cellFlag.HasCellFlag(CellFlag.HasTemporaryBlocker))
|
if (cellFlag.HasCellFlag(CellFlag.HasTemporaryBlocker))
|
||||||
@@ -367,16 +367,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsMoving(Actor self, Actor other)
|
|
||||||
{
|
|
||||||
// PERF: Because we can be sure that OccupiesSpace is Mobile here we can save some performance by avoiding querying for the trait.
|
|
||||||
if (!(other.OccupiesSpace is Mobile otherMobile) || !otherMobile.CurrentMovementTypes.HasMovementType(MovementType.Horizontal))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// PERF: Same here.
|
|
||||||
return self.OccupiesSpace is Mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WorldLoaded(World w, WorldRenderer wr)
|
public void WorldLoaded(World w, WorldRenderer wr)
|
||||||
{
|
{
|
||||||
var map = w.Map;
|
var map = w.Map;
|
||||||
|
|||||||
Reference in New Issue
Block a user