Index: binaries/data/mods/public/simulation/components/Auras.js =================================================================== --- binaries/data/mods/public/simulation/components/Auras.js +++ binaries/data/mods/public/simulation/components/Auras.js @@ -90,7 +90,7 @@ var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player); if (!cmpPlayer) cmpPlayer = QueryOwnerInterface(this.entity); - if (!cmpPlayer) + if (!cmpPlayer || cmpPlayer.GetState() == "defeated") return; var numPlayers = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers(); @@ -423,4 +423,9 @@ } }; +Auras.prototype.OnPlayerDefeated = function(msg) +{ + this.Clean(); +}; + Engine.RegisterComponentType(IID_Auras, "Auras", Auras); Index: binaries/data/mods/public/simulation/components/tests/test_Auras.js =================================================================== --- binaries/data/mods/public/simulation/components/tests/test_Auras.js +++ binaries/data/mods/public/simulation/components/tests/test_Auras.js @@ -8,6 +8,7 @@ let playerID = 1; let playerEnt = 10; +let playerState = "active"; let auraEnt = 20; let targetEnt = 30; let auraRange = 40; @@ -19,7 +20,7 @@ AddMock(SYSTEM_ENTITY, IID_PlayerManager, { "GetPlayerByID": () => playerEnt, - "GetNumPlayers": () => 2, + "GetNumPlayers": () => 2 }); AddMock(SYSTEM_ENTITY, IID_RangeManager, { @@ -28,7 +29,7 @@ "ResetActiveQuery": id => {}, "DisableActiveQuery": id => {}, "DestroyActiveQuery": id => {}, - "GetEntityFlagMask": identifier => {}, + "GetEntityFlagMask": identifier => {} }); AddMock(SYSTEM_ENTITY, IID_DataTemplateManager, { @@ -50,22 +51,23 @@ "IsAlly": id => id == 1, "IsEnemy": id => id != 1, "GetPlayerID": () => 1, + "GetState": () => playerState }); AddMock(targetEnt, IID_Identity, { - "GetClassesList": () => ["CorrectClass", "OtherClass"], + "GetClassesList": () => ["CorrectClass", "OtherClass"] }); AddMock(auraEnt, IID_Position, { - "GetPosition2D": () => new Vector2D(), + "GetPosition2D": () => new Vector2D() }); AddMock(targetEnt, IID_Position, { - "GetPosition2D": () => new Vector2D(), + "GetPosition2D": () => new Vector2D() }); AddMock(auraEnt, IID_Ownership, { - "GetOwner": () => 1, + "GetOwner": () => 1 }); ConstructComponent(SYSTEM_ENTITY, "AuraManager", {}); @@ -109,3 +111,8 @@ cmpAuras.RemoveFormationBonus([targetEnt]); TS_ASSERT_EQUALS(ApplyValueModificationsToEntity("Component/Value", 1, targetEnt), 1); }); + +playerState = "defeated"; +testAuras("global", (name, cmpAuras) => { + TS_ASSERT_EQUALS(ApplyValueModificationsToTemplate("Component/Value", 1, playerID, template), 1); +});