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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user