KSP-KOS / KOS

Fully programmable autopilot mod for KSP. Originally By Nivekk
Other
691 stars 229 forks source link

Mainthrottle and Throttle seem to be independent. Is this intended behavior? #991

Closed Feinbube closed 8 years ago

Feinbube commented 9 years ago

kOS Operating System KerboScript v0.17.2

Proceed. lock throttle to 1. // in game throttle goes up. print throttle + " / " + ship:control:mainthrottle. 1 / 0

lock throttle to 0. // in game throttle goes down. print throttle + " / " + ship:control:mainthrottle. 0 / 0

set ship:control:mainthrottle to 1. // in game throttle goes up. print throttle + " / " + ship:control:mainthrottle. 0 / 1

erendrake commented 9 years ago

the two steering systems are very separate in the code and this was by design. because much of the steering code is slated for a rewrite i have just been hoping no one noticed ;) Sorry if this is causing you trouble

Thank you for your report!

erendrake commented 8 years ago

Even after implementing the new steering, it still makes sense ( at least to me ) to have both.

hvacengi commented 8 years ago

I just wanted to comment that during the most recent revision to steering (included with release v0.20.1) I modified the behavior of the "throttle" getter, so that if lock throttle is not engaged, set t to throttle. will instead set the value to the "current" control state. This will lag one tick behind the values of ship:control but should be close enough to serve your original purpose @Feinbube.

I want to make sure that this is clear, because it's important: throttle will only return the value of ship:control:mainthrottle if you never called lock throttle or if unlock throttle was called. Because the two variables reside in very different places and serve very different functions, it is not really possible to decouple the value of throttle. This may become possible as we move other steering controls to the new kOSVesselModule model. At the very least we should find a way to detect potential conflicts (since you can technically enable both mainthrottle and lock throttle and not receive an error).