From 7f8fc751d4f2edb9246613b55352608b565745bb Mon Sep 17 00:00:00 2001
From: annabunches <annabunches@gmail.com>
Date: Sun, 29 Aug 2021 21:45:50 -0400
Subject: [PATCH] Fix bugs in hover/landing code.

---
 lib/stabilize_rocket.ks | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/stabilize_rocket.ks b/lib/stabilize_rocket.ks
index 4df50e0..58e4ff6 100644
--- a/lib/stabilize_rocket.ks
+++ b/lib/stabilize_rocket.ks
@@ -51,8 +51,8 @@ function Hover {
   restoreControl().
 }
 
-function hoverVectorVac {
-  parameter top.
+function hoverDirVac {
+  parameter top is SHIP:FACING:TOPVECTOR.
   if SHIP:VERTICALSPEED > 0 {
     return SHIP:UP.
   }
@@ -60,12 +60,12 @@ function hoverVectorVac {
 }
 
 function alignForHover {
-  set top to SHIP:FACING:FOREVECTOR.
+  set top to SHIP:FACING:TOPVECTOR.
   if ReadSensor("PRES") = 0 {
     // if we're in a vacuum, align with retrograde for smoother horizontal control.
     lock STEERING to hoverDirVac(top).
     print "Aligning with retrograde.".
-    wait until done or VAng(SHIP:FACING:FOREVECTOR, hoverDirVac():FOREVECTOR) < 1.
+    wait until done or VAng(SHIP:FACING:FOREVECTOR, hoverDirVac(top):FOREVECTOR) < 1.
     if done {
       return.
     }