KSP-RO / RealFuels

Modular fuel tanks and engines, with real fuels and realistic performance.
54 stars 66 forks source link

NaN when thrust is rounded below 0.1 N #320

Closed Capkirk123 closed 11 months ago

Capkirk123 commented 1 year ago

If an engine has a thrust below 0.05 N, such that the display value is rounded down, the thrust is simply set to NaN and the engine does not work. RF seems to have no issue displaying smaller values (an engine with a thrust of 0.1 N will happily display throttled thrust in milli- or micro-Newtons), the issue only occurs if the config thrust is set too low.

This effects a lot of ion engines, since most of them have very low thrust values.

Capkirk123 commented 1 year ago

Upon some investigation (by siimav), it seems like a potential cause is an incorrectly set up if else at https://github.com/KSP-RO/RealFuels/blob/f2b440d5731c4a804f6c832cbd933e6227a2d625/Source/Utilities/Utilities.cs#L189

siimav commented 1 year ago

That shouldn't actually be an issue. I get extra jumpy when someone writes inconsistent ifs and else ifs after one another. It's a definite code smell but doesn't actually matter since there's a return.