From e396ff170ee155e49680d2eda2d0896509699ea6 Mon Sep 17 00:00:00 2001 From: mimo Date: Sun, 15 Oct 2017 15:14:11 +0000 Subject: [PATCH] No need to create aura's rangequery when the aura is not applied Reviewed By: fatherbushido Differential Revision: https://code.wildfiregames.com/D963 This was SVN commit r20300. --- .../public/simulation/components/Auras.js | 22 +++++++++++-------- .../components/RangeVisualization.js | 4 +++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/binaries/data/mods/public/simulation/components/Auras.js b/binaries/data/mods/public/simulation/components/Auras.js index 18d616eb6d..53fe2610dd 100644 --- a/binaries/data/mods/public/simulation/components/Auras.js +++ b/binaries/data/mods/public/simulation/components/Auras.js @@ -258,15 +258,19 @@ Auras.prototype.Clean = function() } needVisualizationUpdate = true; - this[name].rangeQuery = cmpRangeManager.CreateActiveQuery( - this.entity, - 0, - this.GetRange(name), - affectedPlayers, - IID_Identity, - cmpRangeManager.GetEntityFlagMask("normal") - ); - cmpRangeManager.EnableActiveQuery(this[name].rangeQuery); + + if (this[name].isApplied) + { + this[name].rangeQuery = cmpRangeManager.CreateActiveQuery( + this.entity, + 0, + this.GetRange(name), + affectedPlayers, + IID_Identity, + cmpRangeManager.GetEntityFlagMask("normal") + ); + cmpRangeManager.EnableActiveQuery(this[name].rangeQuery); + } } if (needVisualizationUpdate) diff --git a/binaries/data/mods/public/simulation/components/RangeVisualization.js b/binaries/data/mods/public/simulation/components/RangeVisualization.js index b52f286fb7..7f5202575c 100644 --- a/binaries/data/mods/public/simulation/components/RangeVisualization.js +++ b/binaries/data/mods/public/simulation/components/RangeVisualization.js @@ -100,7 +100,9 @@ RangeVisualization.prototype.OnValueModification = function(msg) this.RegenerateRangeVisualizations(false); }; -/** RangeVisualization component is deserialized before the TechnologyManager, so need to update the ranges here */ +/** + * RangeVisualization component is deserialized before the TechnologyManager, so need to update the ranges here + */ RangeVisualization.prototype.OnDeserialized = function(msg) { for (let type in this.enabledRangeTypes)