Prevent multiple Transforms from triggering in the same tick.

This leads to actor duplication.
This commit is contained in:
Paul Chote
2018-12-05 21:01:00 +00:00
committed by reaperrr
parent 72923b9572
commit 4b6853b433
3 changed files with 8 additions and 1 deletions

View File

@@ -42,6 +42,7 @@ namespace OpenRA
public Player Owner { get; internal set; }
public bool IsInWorld { get; internal set; }
public bool WillDispose { get; private set; }
public bool Disposed { get; private set; }
public Activity CurrentActivity { get; private set; }
@@ -284,6 +285,9 @@ namespace OpenRA
if (CurrentActivity != null)
CurrentActivity.RootActivity.OnActorDisposeOuter(this);
// Allow traits/activities to prevent a race condition when they depend on disposing the actor (e.g. Transforms)
WillDispose = true;
World.AddFrameEndTask(w =>
{
if (Disposed)