Starwaster / DeadlyReentry

Heat and force damage for KSP
Other
31 stars 19 forks source link

Fix negative damage applied when a part's internal temperature goes over operational temp #52

Closed NathanKell closed 3 years ago

NathanKell commented 3 years ago

With the code as written, when operationalTemp for a part is > 322, the result of tempRatio will be negative. Due to the comment, I believe the original intent was to apply capping to the temp ratio just for scream and reaction purposes, not to cap (let alone make negative) all parts' damage.

This also includes a fix to kerbal screams where, while the internal temp scream checked vs nextScream, the skintemp version did not, leading to the PlaySound call being spammed every physics tick.

Starwaster commented 3 years ago

Thinking I should have stuck the screaming in ModuleKerbalAeroReentry. Both of them went into the same update but I'd already written the screaming section before deciding to give Kerbals their own module.

NathanKell commented 3 years ago

That could work too. Either way though the code as written only applies damage when a part's maxOperationalTemp is < 322.15 (and produces a div0 if it is precisely 322.15); in all other cases it will only apply negative damage, so one way or another I do believe that bit needs to be fixed.