Use OccupiesSpace to save more trait look-ups
This time in Locomotor.IsBlockedBy.
This commit is contained in:
committed by
Matthias Mailänder
parent
55e85bd9ca
commit
f58c3aed32
@@ -348,7 +348,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (check <= BlockedByActor.Immovable && cellFlag.HasCellFlag(CellFlag.HasMovableActor) &&
|
||||
actor.Owner.Stances[otherActor.Owner] == Stance.Ally)
|
||||
{
|
||||
var mobile = otherActor.TraitOrDefault<Mobile>();
|
||||
var mobile = otherActor.OccupiesSpace as Mobile;
|
||||
if (mobile != null && !mobile.IsTraitDisabled && !mobile.IsTraitPaused && !mobile.IsImmovable)
|
||||
return false;
|
||||
}
|
||||
@@ -369,7 +369,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (cellFlag.HasCellFlag(CellFlag.HasTransitOnlyActor))
|
||||
{
|
||||
// Transit only tiles should not block movement
|
||||
var building = otherActor.TraitOrDefault<Building>();
|
||||
var building = otherActor.OccupiesSpace as Building;
|
||||
if (building != null && building.TransitOnlyCells().Contains(cell))
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user