[0.16.51] Unit not dying when decrementing health to zero

Post your bugs and problems so we can fix them.

[0.16.51] Unit not dying when decrementing health to zero

Postby 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?
TheSAguy
Smart Inserter
Smart Inserter
 
Posts: 1224
Joined: Mon Jan 13, 2014 6:17 pm

Re: Unit not dying

Postby 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
DaveMcW
Smart Inserter
Smart Inserter
 
Posts: 2392
Joined: Tue May 13, 2014 11:06 am

Re: Unit not dying

Postby 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
darkfrei
Smart Inserter
Smart Inserter
 
Posts: 1231
Joined: Thu Nov 20, 2014 11:11 pm

Re: Unit not dying

Postby 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?
User avatar
eradicator
Smart Inserter
Smart Inserter
 
Posts: 1783
Joined: Tue Jul 12, 2016 9:03 am
Location: Mod support languages: JA/DE/EN

Re: Unit not dying

Postby 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
darkfrei
Smart Inserter
Smart Inserter
 
Posts: 1231
Joined: Thu Nov 20, 2014 11:11 pm

Re: Unit not dying

Postby 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.
No matter what you do, you can't please everyone.
User avatar
bobingabout
Smart Inserter
Smart Inserter
 
Posts: 5706
Joined: Fri May 09, 2014 1:01 pm
Location: England


Return to Bug Reports

Who is online

Users browsing this forum: Google [Bot] and 4 guests