Implement align_with-function so as to not repeat ourselves too much.

This commit is contained in:
Casper V. Kristensen 2019-02-09 21:20:37 +01:00
parent 3a1a120ba9
commit 694eeac86f
Signed by: caspervk
GPG key ID: 289CA03790535054

View file

@ -67,6 +67,24 @@ function extend_antennas {
}
function align_with {
//
// Aligns the rocket with the given vector or node.
//
parameter direction. // Vector or Node
parameter tolerance is 0.5.
local alignment_vector is direction.
if direction:istype("Node") {
lock alignment_vector to direction:burnvector. // locking allows steering to dynamically update when the node does
}
SAS off.
lock STEERING to alignment_vector.
wait until vang(SHIP:facing:vector, alignment_vector) <= tolerance.
}
function unlock_control {
//
// Ensure that the throttle is 0 and that the player is not locked out of control.