KSP-RO / SolverEngines

A subclass of ModuleEnginesFX which supports AJE-style solvers.
8 stars 19 forks source link

The "CLAMP = float.MaxValue" hack is breaking current version of TCA. #18

Closed allista closed 4 years ago

allista commented 8 years ago

FYI:

Here's the line I'm referencing to.

ThrottleControlledAvionics uses the code from ModuleEngines.ModifyFlow() to calculate the fuel flow modifier. This hack effectively sets the modifier to MaxValue as well, which causes the calculated thrust to be Infinity.

Right now I've added a workaround: the CLAMP is used only when it is less than 1. But maybe you could handle flameouts in a less radical way that does not generate such unexpected values? :) Could setting CLAMP to 1 do the same trick?

lamont-granquist commented 5 years ago

I also just ran into this breaking some code I wrote for MechJeb.

blowfishpro commented 5 years ago

NathanKell wrote this code but has been pretty inactive lately. I'll try to understand why this was done this way if I have time soon.

Starwaster commented 5 years ago

According to the comments, that whole bit was a dirty hack to get around ModuleEngineFX.CanStart() not being virtual ... except that currently it IS so what needs to happen is that an override CanStart method needs to be written which has a check that flameout is true (and returns that if necessary) and remove the two lines that tamper with CLAMP.

Starwaster commented 5 years ago

This will be addressed in the update for KSP 1.6

DRVeyl commented 4 years ago

Fixed with https://github.com/KSP-RO/SolverEngines/commit/2583d99afcbda633b4dbc09ce30147cb41a20cfc