improved command to change control mode

This commit is contained in:
Alexsandro Percy 2023-06-27 20:30:10 -03:00
parent 1678a6b1c7
commit 91976f047a
2 changed files with 13 additions and 16 deletions

View file

@ -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

View file

@ -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