bld / PersistentThrust

Kerbal Space Program plugin that implements low thrust propulsion during timewarp with systems like solar sails and ion engines.
http://forum.kerbalspaceprogram.com/index.php?/topic/120404-wip113-persistentthrust-v106/
Other
6 stars 5 forks source link

Update persistent thrust parameters only every 16th physics tick #2

Closed octarine-noise closed 7 years ago

octarine-noise commented 7 years ago

There is a problem with being unable to enter thrust warp when game physics is lagging.

It seems there are a couple of extra calls to OnFixedUpdate() when trying to enter on-rails warp when lagging, where the vessel is not yet packed, but thrust is set to 0. This causes the engine to request 0 propellant in the first physics tick where the vessel is packed, which (although successful of course) is interpreted as the vessel being out of propellant, and the warp is interrupted.

This PR is a quick & dirty workaround to that problem, making the persistent thrust parameters update only every 16th physics tick. This makes them lag behind a bit (about 1/3 second, no big deal), which ensures thrust warp can be entered fairly consistently, although there is still the occasional unlucky activation, where the timewarp button is pressed in the wrong "phase".

There is also now an on-screen message when propellant is depleted (or not, see above), to give the player feedback.

bld commented 7 years ago

Thanks. I'll take a look at it tonight and try to get an update out.