[0.16.51] Unit not dying when decrementing health to zero

This subforum contains all the issues which we already resolved.
Post Reply
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

[0.16.51] Unit not dying when decrementing health to zero

Post by TheSAguy »

Hi,

I've created a unit with a negative healing_per_tick = -1
So it should only have a certain time to live.

What seems to happen though, is that once it reaches 0, it does not die, and actually becomes immortal once it reaches 0.
So, the player of player's units can kill it if they damage it before it's health reaches 0, but once it reaches 0, it can't be killed....

Image

Once it reaches 0, I cant target it to kill...

Image
This seems to be a bug, but I'm not entirely sure...

Any code I can provide to help out?

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Unit not dying

Post by DaveMcW »

You should probably report this in the bug forum.

Possible developer solutions:
- Kill unit when healing_per_tick takes HP to zero.
- healing_per_tick does not bring unit below 1 HP.
- Don't allow negative healing_per_tick

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Unit not dying

Post by darkfrei »

DaveMcW wrote:You should probably report this in the bug forum.

Possible developer solutions:
- Kill unit when healing_per_tick takes HP to zero.
- healing_per_tick does not bring unit below 1 HP.
- Don't allow negative healing_per_tick
The last is much more friendly for ups, so it will be so realized.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Unit not dying

Post by eradicator »

I doubt UPS cares about +1 or -1. Just kill the thing when it drops to hp <= 0.
Does on_entity_damaged trigger for self-mutilation?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Unit not dying

Post by darkfrei »

eradicator wrote:I doubt UPS cares about +1 or -1. Just kill the thing when it drops to hp <= 0.
Then every healing (negative healing) entity must be checked, if the health is 100% and if the health is ≤0.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7351
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Unit not dying

Post by bobingabout »

Arguing that killing an entity if the health drops below 0 being too power hungry is... pointless really.

if you could see just how complex some of these functions already are, you'd realise it already does <=0 and <=1 checks all over the place to bring them back to 0 and 1. Adding one to healing per tick isn't going to kill performance, and calling this.die() if it does drop to or below 0 should be very possible.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

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

Re: [0.16.51] Unit not dying when decrementing health to zero

Post by Rseding91 »

Thanks for the report. I've changed it for 0.17 so when an entity has healing_per_tick of a negative value when it reaches 0 health it dies.
If you want to get ahold of me I'm almost always on Discord.

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: [0.16.51] Unit not dying when decrementing health to zero

Post by TheSAguy »

Great!
This now allows for a strong early unit, that if you can't kill, you just have to run away, it will eventually die :)
Thanks.

Post Reply

Return to “Resolved Problems and Bugs”