zorkind / Hellion-Rescue-Project

54 stars 7 forks source link

Civilian Nanite Core T4 time math error #313

Closed zorkind closed 3 years ago

zorkind commented 3 years ago

Vanilla / HRP Vanilla.

Client Version 0.5.2

Describe the bug The amount of health (Time) the T4 civilian nanite has is decreased by 2 each second, instead of 1.

To Reproduce Steps to reproduce the behavior:

  1. Go to any ship/module
  2. Plug a civilian Nanite Core 4 in the slot
  3. Check environment panel
  4. See error

Expected behavior It should consume 1 second each second, from the time remaining (health), for all nanite cores.

Screenshots None.

Additional context None.

zorkind commented 3 years ago

The Nanite 4 was producing a too high value for a floating point and that was causing arithmetic errors. The values were reduced to avoid this issue, the best solution is to change the type to double precision, but that is a big change in the code and based on how high the original values are, i am sure we can reduce without a big impact in game play.

This sheet shows how the values were originally and how they are after the change. image

obs.: Taking into account that Arges uses double nanites, these values are acceptable with double T4s in the Arges, producing a float that is still bellow the limit, but dangerously near it.