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.
This commit is contained in:
elexis 2018-04-24 17:28:24 +00:00
parent 86fcf0de8c
commit ec8d95abe1

View file

@ -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);