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

Bugs that are actually features.
Post Reply
User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

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

Post 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

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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().
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Not a bug”