1
0
forked from 0ad/0ad

Readd safeguard against killing an entity multiple times.

Also don't try to calculate more when we are damaged with zero (`0`)
amount.

Differential Revision: D2981
Reviewed by: @Angen.
This was SVN commit r24006.
This commit is contained in:
Freagarach 2020-08-29 05:47:06 +00:00
parent 5e6a2322e7
commit 0530602405

View File

@ -186,6 +186,9 @@ Health.prototype.Kill = function()
*/
Health.prototype.TakeDamage = function(amount, attacker, attackerOwner)
{
if (!amount || !this.hitpoints)
return { "healthChange": 0 };
let change = this.Reduce(amount);
let cmpLoot = Engine.QueryInterface(this.entity, IID_Loot);