[0.16.51] Unit not dying when decrementing health to zero

Post Reply
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1247
Joined: Mon Jan 13, 2014 6:17 pm

[0.16.51] Unit not dying when decrementing health to zero

Post by TheSAguy » Wed Jul 11, 2018 9:03 pm

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: 2532
Joined: Tue May 13, 2014 11:06 am

Re: Unit not dying

Post by DaveMcW » Wed Jul 11, 2018 9:38 pm

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: 1511
Joined: Thu Nov 20, 2014 11:11 pm

Re: Unit not dying

Post by darkfrei » Thu Jul 12, 2018 7:05 am

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: 2604
Joined: Tue Jul 12, 2016 9:03 am

Re: Unit not dying

Post by eradicator » Thu Jul 12, 2018 7:16 am

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: Hand Crank Generator, Screenshot Hotkey 2.0
Mod support languages: 日本語, Deutsch, English

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

Re: Unit not dying

Post by darkfrei » Thu Jul 12, 2018 7:27 am

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: 6026
Joined: Fri May 09, 2014 1:01 pm

Re: Unit not dying

Post by bobingabout » Thu Jul 12, 2018 8:06 am

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.

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

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

Post by Rseding91 » Tue Jul 31, 2018 3:55 am

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 IRC and Discord.

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

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

Post by TheSAguy » Tue Jul 31, 2018 5:56 pm

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 for 0.17”