From ec8d95abe1e62bd4d89cba3c1bf1793c7d43c24e Mon Sep 17 00:00:00 2001 From: elexis Date: Tue, 24 Apr 2018 17:28:24 +0000 Subject: [PATCH] Update auras of entities of other players that affected the defeated player after 2651caa885 removed this case handling unintentionally. Also avoids some unneded player entity aura cleans. Differential Revision: https://code.wildfiregames.com/D1453 Reported and comments by: fatherbushido Reviewed By: temple refs #5099 This was SVN commit r21779. --- .../data/mods/public/simulation/components/Auras.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/binaries/data/mods/public/simulation/components/Auras.js b/binaries/data/mods/public/simulation/components/Auras.js index ed6fca9db0..a23463eb8b 100644 --- a/binaries/data/mods/public/simulation/components/Auras.js +++ b/binaries/data/mods/public/simulation/components/Auras.js @@ -480,14 +480,14 @@ Auras.prototype.OnGlobalResearchFinished = function(msg) }; /** - * Only update playerauras, since units and structures are updated OnOwnershipChanged. + * Update auras of the player entity and entities affecting player entities that didn't change ownership. */ Auras.prototype.OnGlobalPlayerDefeated = function(msg) { - if (!Engine.QueryInterface(this.entity, IID_Player)) - return; - - this.Clean(); + let cmpPlayer = Engine.QueryInterface(this.entity, IID_Player); + if (cmpPlayer && cmpPlayer.GetPlayerID() == msg.playerId || + this.GetAuraNames().some(name => this.GetAffectedPlayers(name).indexOf(msg.playerId) != -1)) + this.Clean(); }; Engine.RegisterComponentType(IID_Auras, "Auras", Auras);