attack if in range of any cell of a building

This commit is contained in:
Bob
2010-11-03 21:06:55 +13:00
committed by Chris Forbes
parent c3fc7b98f3
commit 50b1ba3acc
8 changed files with 56 additions and 7 deletions

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA.Activities
var mobile = self.Trait<Mobile>();
var targetCell = Util.CellContaining(Target.CenterLocation);
if ((targetCell - self.Location).LengthSquared >= Range * Range)
if (!Combat.IsInRange( self.CenterLocation, Range, Util.CenterOfCell(targetCell)))
return Util.SequenceActivities( mobile.MoveTo( Target, Range ), this );
var desiredFacing = Util.GetFacing((targetCell - self.Location).ToFloat2(), 0);