[1.1.80] Incorrect number of shots needed to destroy entities

We are aware of them, but they have low priority. We have more important things to do. They go here in order not to take space in the main bug thread list.
Post Reply
xfret
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Apr 11, 2021 10:40 am
Contact:

[1.1.80] Incorrect number of shots needed to destroy entities

Post by xfret »

This is such a small thing but I thought I'd report it anyways. I shot a wooden chest (exactly 100 health) with a pistol shooting firearm magazines (exactly 5 damage). It took 21 shots to destroy. Setting the chest to 10 health in editor mode takes 3 shots to destroy, but setting it to 5 health takes only 1. I would expect more consistency (either allowing entities to be at zero health or not) if this is possible.
Attachments
factorio-current.log
(6.83 KiB) Downloaded 32 times

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2252
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.80] Incorrect number of shots needed to destroy entities

Post by boskid »

I am really not sure how important is this to be fixed, i could add an epsilon on the health condition to make entity die if the health drops below 0.01 or some other small number. Right now entity only dies when the health drops exactly to a value of 0 while being damaged and the behavior you see is caused by the floating point math imprecision: in the game state, EntityWithHealth does not hold a health value, but a health ratio which changes between 0.0f and 1.0f. Whenever a health value is requested a healthRatio is multiplied by a maxHealth from the prototype. In this case when a wooden chest is being damaged from 65 HP down to 60 HP, the health ratio becomes equal to 0.600000024 which causes entity to have 60.0000038 HP. From this point you need to shoot one extra time to make its health drop to 0.

xfret
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Apr 11, 2021 10:40 am
Contact:

Re: [1.1.80] Incorrect number of shots needed to destroy entities

Post by xfret »

Probably not important yeah. But do I get to at least say I found a bug? :D

Post Reply

Return to “Minor issues”