From 694eeac86f131894ea09abde91c310415b163850 Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Sat, 9 Feb 2019 21:20:37 +0100 Subject: [PATCH] Implement align_with-function so as to not repeat ourselves too much. --- lib/rocket.ks | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/rocket.ks b/lib/rocket.ks index 75138d8..8d65b95 100644 --- a/lib/rocket.ks +++ b/lib/rocket.ks @@ -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.