From fc6ada38f4909302a99887f371b6ae4f2350bdf1 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 28 Oct 2018 17:14:17 +0000 Subject: [PATCH] Revoke WithMakeAnimation condition at the end of the tick. This fixes traits becoming enabled for a tick between the animation completing and the actor being removed from the world. --- .../Traits/Render/WithMakeAnimation.cs | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs index 5a6fd48319..29a0ad2299 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs @@ -68,11 +68,14 @@ namespace OpenRA.Mods.Common.Traits.Render wsb.PlayCustomAnimation(self, info.Sequence, () => { - if (token != ConditionManager.InvalidConditionToken) - token = conditionManager.RevokeCondition(self, token); + self.World.AddFrameEndTask(w => + { + if (token != ConditionManager.InvalidConditionToken) + token = conditionManager.RevokeCondition(self, token); - // TODO: Rewrite this to use a trait notification for save game support - onComplete(); + // TODO: Rewrite this to use a trait notification for save game support + onComplete(); + }); }); } @@ -88,11 +91,14 @@ namespace OpenRA.Mods.Common.Traits.Render wsb.PlayCustomAnimationBackwards(self, info.Sequence, () => { - if (token != ConditionManager.InvalidConditionToken) - token = conditionManager.RevokeCondition(self, token); + self.World.AddFrameEndTask(w => + { + if (token != ConditionManager.InvalidConditionToken) + token = conditionManager.RevokeCondition(self, token); - // TODO: Rewrite this to use a trait notification for save game support - onComplete(); + // TODO: Rewrite this to use a trait notification for save game support + onComplete(); + }); }); }