Add a force flag to nudging which skips the ownership and idle checks

This commit is contained in:
Paul Chote
2011-07-10 17:37:12 +12:00
parent 98ae8c7630
commit 74d13286a8
3 changed files with 6 additions and 7 deletions

View File

@@ -269,7 +269,7 @@ namespace OpenRA.Mods.RA.Move
if (order.OrderString == "Scatter")
{
OnNudge(self, self);
OnNudge(self, self, true);
}
}
@@ -365,15 +365,14 @@ namespace OpenRA.Mods.RA.Move
self.World.ActorMap.Remove(self, this);
}
public void OnNudge(Actor self, Actor nudger)
public void OnNudge(Actor self, Actor nudger, bool force)
{
/* initial fairly braindead implementation. */
if (self.Owner.Stances[nudger.Owner] != Stance.Ally)
if (!force && self.Owner.Stances[nudger.Owner] != Stance.Ally)
return; /* don't allow ourselves to be pushed around
* by the enemy! */
if (!self.IsIdle)
if (!force && !self.IsIdle)
return; /* don't nudge if we're busy doing something! */
// pick an adjacent available cell.