From 91976f047a8373c186e5724cd84ee8c889eeb3e6 Mon Sep 17 00:00:00 2001
From: Alexsandro Percy <alexsandro.percy@gmail.com>
Date: Tue, 27 Jun 2023 20:30:10 -0300
Subject: [PATCH] improved command to change control mode

---
 lib_planes/control.lua  | 18 +++++++++++++-----
 lib_planes/entities.lua | 11 -----------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/lib_planes/control.lua b/lib_planes/control.lua
index f3959de..4f1740f 100755
--- a/lib_planes/control.lua
+++ b/lib_planes/control.lua
@@ -46,11 +46,7 @@ function airutils.control(self, dtime, hull_direction, longit_speed, longit_drag
         --engine and power control
         if ctrl.aux1 and self._last_time_command > 0.5 then
             self._last_time_command = 0
-            if self._yaw_by_mouse == true then
-                self._yaw_by_mouse = false
-            else
-                self._yaw_by_mouse = true
-            end
+
         end
 
         self._acceleration = 0
@@ -131,6 +127,18 @@ function airutils.control(self, dtime, hull_direction, longit_speed, longit_drag
             self._elevator_angle = 0
             self._rudder_angle = 0
         end
+
+        if ctrl.up and ctrl.down and self._last_time_command > 0.5 then
+            self._last_time_command = 0
+            local name = player:get_player_name()
+            if self._yaw_by_mouse == true then
+                minetest.chat_send_player(name, core.colorize('#0000ff', " >>> Mouse control disabled."))
+                self._yaw_by_mouse = false
+            else
+                minetest.chat_send_player(name, core.colorize('#0000ff', " >>> Mouse control enabled."))
+                self._yaw_by_mouse = true
+            end
+        end
 	end
 
     if longit_speed > 0 then
diff --git a/lib_planes/entities.lua b/lib_planes/entities.lua
index c0f4d3a..946d7de 100644
--- a/lib_planes/entities.lua
+++ b/lib_planes/entities.lua
@@ -158,17 +158,6 @@ function airutils.logic(self)
                 end
             end
         end
-        ----------------------------------
-        -- shows the hud for the player
-        ----------------------------------
-        if ctrl.up == true and ctrl.down == true and self._last_time_command >= 1 then
-            self._last_time_command = 0
-            if self._show_hud == true then
-                self._show_hud = false
-            else
-                self._show_hud = true
-            end
-        end
     end
 
     local accel_y = self.object:get_acceleration().y