From a6159e4ac6efc9495eb11303ccbf977fcda04245 Mon Sep 17 00:00:00 2001 From: Angen Date: Sat, 1 Feb 2020 13:46:23 +0000 Subject: [PATCH] Lower number of setdefaultanimation calls in gathering state Move call to SetDefaultAnimationVariant to leave function upon leaving GATHERING state instead for every one substate leave. Differential Revision: https://code.wildfiregames.com/D2565 This was SVN commit r23474. --- .../data/mods/public/simulation/components/UnitAI.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/binaries/data/mods/public/simulation/components/UnitAI.js b/binaries/data/mods/public/simulation/components/UnitAI.js index 2096f0462d..e03bc9c3de 100644 --- a/binaries/data/mods/public/simulation/components/UnitAI.js +++ b/binaries/data/mods/public/simulation/components/UnitAI.js @@ -2144,6 +2144,11 @@ UnitAI.prototype.UnitFsmSpec = { }, "GATHER": { + "leave": function() { + // Show the carried resource, if we've gathered anything. + this.SetDefaultAnimationVariant(); + }, + "APPROACHING": { "enter": function() { this.gatheringTarget = this.order.data.target; // temporary, deleted in "leave". @@ -2186,7 +2191,6 @@ UnitAI.prototype.UnitFsmSpec = { "leave": function() { this.StopMoving(); - this.SetDefaultAnimationVariant(); if (!this.gatheringTarget) return; // don't use ownership because this is called after a conversion/resignation @@ -2211,7 +2215,6 @@ UnitAI.prototype.UnitFsmSpec = { }, "leave": function() { - this.SetDefaultAnimationVariant(); this.StopMoving(); }, @@ -2294,9 +2297,7 @@ UnitAI.prototype.UnitFsmSpec = { cmpSupply.RemoveGatherer(this.entity); delete this.gatheringTarget; - // Show the carried resource, if we've gathered anything. this.ResetAnimation(); - this.SetDefaultAnimationVariant(); }, "Timer": function(msg) {