Merge pull request #11308 from reaperrr/fix-11304-IsMoving

Fix IsMoving returning false when activity is a MovePart-derivative
This commit is contained in:
Paul Chote
2016-06-18 11:32:51 +01:00
committed by GitHub
3 changed files with 7 additions and 24 deletions

View File

@@ -168,7 +168,7 @@ namespace OpenRA.Mods.Common.Traits
public int CalculateTilesetMovementClass(TileSet tileset)
{
/* collect our ability to cross *all* terraintypes, in a bitvector */
// collect our ability to cross *all* terraintypes, in a bitvector
return TilesetTerrainInfo[tileset].Select(ti => ti.Cost < int.MaxValue).ToBits();
}
@@ -179,13 +179,13 @@ namespace OpenRA.Mods.Common.Traits
static bool IsMovingInMyDirection(Actor self, Actor other)
{
if (!other.IsMoving()) return false;
var selfMobile = self.TraitOrDefault<Mobile>();
if (selfMobile == null) return false;
if (selfMobile == null)
return false;
var otherMobile = other.TraitOrDefault<Mobile>();
if (otherMobile == null) return false;
if (otherMobile == null || !otherMobile.IsMoving)
return false;
// Sign of dot-product indicates (roughly) if vectors are facing in same or opposite directions:
var dp = CVec.Dot(selfMobile.ToCell - self.Location, otherMobile.ToCell - other.Location);