NotifyBlocker extension method for Actor

This commit is contained in:
atimoschenkow
2015-01-10 12:01:29 +01:00
parent ae03fa9af5
commit cefd554a5e
4 changed files with 25 additions and 23 deletions

View File

@@ -202,16 +202,6 @@ namespace OpenRA.Mods.Common.Activities
throw new InvalidOperationException("(Move) Sanity check failed");
}
static void NotifyBlocker(Actor self, CPos nextCell)
{
foreach (var blocker in self.World.ActorMap.GetUnitsAt(nextCell))
{
// Notify the blocker that he's blocking our move:
foreach (var moveBlocked in blocker.TraitsImplementing<INotifyBlockingMove>())
moveBlocked.OnNotifyBlockingMove(blocker, self);
}
}
Pair<CPos, SubCell>? PopPath(Actor self, Mobile mobile)
{
if (path.Count == 0)
@@ -233,7 +223,7 @@ namespace OpenRA.Mods.Common.Activities
// See if they will move
if (!hasNotifiedBlocker)
{
NotifyBlocker(self, nextCell);
self.NotifyBlocker(nextCell);
hasNotifiedBlocker = true;
}