Add OnActorDispose plumbing to Activity

This allows activities to perform necessary cleanups on actor
death/disposal, for example by running OnLastRun directly,
which would otherwise be skipped when the actor dies or is disposed
through other means.
This commit is contained in:
reaperrr
2018-09-17 01:57:37 +02:00
committed by abcdefg30
parent e8eb4d9563
commit 9bcb754836
2 changed files with 23 additions and 0 deletions

View File

@@ -265,6 +265,11 @@ namespace OpenRA
public void Dispose()
{
// If CurrentActivity isn't null, run OnActorDisposeOuter in case some cleanups are needed.
// This should be done before the FrameEndTask to avoid dependency issues.
if (CurrentActivity != null)
CurrentActivity.RootActivity.OnActorDisposeOuter(this);
World.AddFrameEndTask(w =>
{
if (Disposed)