Page 1 of 1

[0.17] setting entity.health to 0 or less interrupts death check

Posted: Wed Nov 07, 2018 3:28 pm
by Mylon
Using this code:

Code: Select all

/c p = game.player p.surface.create_entity{name="acid-projectile-purple", target=p.character, position=p.character.position, speed=10} p.character.health=-20 end
The player does not die as expected.

Tested using a build from 31st Oct 2018

Re: [0.17] setting entity.health to 0 or less interrupts death check

Posted: Wed Nov 07, 2018 7:03 pm
by Rseding91
Thanks for the report however that's working as intended. By setting the health to a value < 0 it sets it to 0. By setting health to 0 you aren't killing the entity.

If you want to kill the entity you need to call entity.die() or to just delete it: entity.destroy().