Check proc's health before (un)docking. Fixes #5338

This commit is contained in:
Oliver Brakmann
2014-05-17 16:57:55 +02:00
parent 578b071fd4
commit 062e7f5298
2 changed files with 13 additions and 9 deletions

View File

@@ -54,8 +54,9 @@ namespace OpenRA.Mods.Cnc
case State.Dock:
ru.PlayCustomAnimation(self, "dock", () => {
ru.PlayCustomAnimRepeating(self, "dock-loop");
foreach (var nd in proc.TraitsImplementing<INotifyDocking>())
nd.Docked(proc, self);
if (proc.IsInWorld && !proc.IsDead())
foreach (var nd in proc.TraitsImplementing<INotifyDocking>())
nd.Docked(proc, self);
state = State.Loop;
});
state = State.Wait;
@@ -66,8 +67,9 @@ namespace OpenRA.Mods.Cnc
return this;
case State.Undock:
ru.PlayCustomAnimBackwards(self, "dock", () => state = State.DragOut);
foreach (var nd in proc.TraitsImplementing<INotifyDocking>())
nd.Undocked(proc, self);
if (proc.IsInWorld && !proc.IsDead())
foreach (var nd in proc.TraitsImplementing<INotifyDocking>())
nd.Undocked(proc, self);
state = State.Wait;
return this;
case State.DragOut:
@@ -87,4 +89,4 @@ namespace OpenRA.Mods.Cnc
yield return Target.FromActor(proc);
}
}
}
}