This commit is contained in:
Chris Forbes
2009-10-26 13:44:31 +13:00
parent 2058134380
commit b0cf14b3eb
2 changed files with 8 additions and 5 deletions

View File

@@ -130,6 +130,12 @@ namespace OpenRa.Game.Traits
public MoveTo( int2 destination )
{
this.destination = destination;
}
bool CanEnterCell(int2 c, Actor self)
{
var u = Game.UnitInfluence.GetUnitAt(c);
return u == null || u == self;
}
public void Tick( Actor self, Mobile mobile )
@@ -161,9 +167,8 @@ namespace OpenRa.Game.Traits
mobile.currentAction = new Turn( firstFacing ) { NextAction = this };
else
{
var unitAtDest = Game.UnitInfluence.GetUnitAt(nextCell);
if ( unitAtDest != null && unitAtDest != self )
return; /* todo: repath, sometimes */
if (!CanEnterCell(nextCell, self)) return; /* todo: repath, sometimes */
mobile.toCell = nextCell;
path.RemoveAt( path.Count - 1 );
moveFractionTotal = ( dir.X != 0 && dir.Y != 0 ) ? 35 : 25;