diff --git a/init.lua b/init.lua index a692bbb..50c1183 100644 --- a/init.lua +++ b/init.lua @@ -96,10 +96,11 @@ function airutils.setText(self, vehicle_name) end function airutils.transfer_control(self, status) + if not self._have_copilot then return end if status == false then self._command_is_given = false - if self._passenger then - minetest.chat_send_player(self._passenger, + if self.co_pilot then + minetest.chat_send_player(self.co_pilot, core.colorize('#ff0000', " >>> The captain got the control.")) end if self.driver_name then @@ -108,8 +109,8 @@ function airutils.transfer_control(self, status) end else self._command_is_given = true - if self._passenger then - minetest.chat_send_player(self._passenger, + if self.co_pilot then + minetest.chat_send_player(self.co_pilot, core.colorize('#00ff00', " >>> The control is with you now.")) end if self.driver_name then minetest.chat_send_player(self.driver_name," >>> The control was given.") end diff --git a/lib_planes/entities.lua b/lib_planes/entities.lua index c28092c..6b042d8 100644 --- a/lib_planes/entities.lua +++ b/lib_planes/entities.lua @@ -159,15 +159,15 @@ function airutils.logic(self) local player = nil if self.driver_name then player = minetest.get_player_by_name(self.driver_name) end - local passenger = nil - if self._passenger then passenger = minetest.get_player_by_name(self._passenger) end + local co_pilot = nil + if self.co_pilot and self._have_copilot then co_pilot = minetest.get_player_by_name(self.co_pilot) end if player then local ctrl = player:get_player_control() --------------------- -- change the driver --------------------- - if passenger and self._last_time_command >= 1 and self._instruction_mode == true then + if co_pilot and self._have_copilot and self._last_time_command >= 1 and self._instruction_mode == true then if self._command_is_given == true then if ctrl.sneak or ctrl.jump or ctrl.up or ctrl.down or ctrl.right or ctrl.left then self._last_time_command = 0 @@ -175,11 +175,11 @@ function airutils.logic(self) airutils.transfer_control(self, false) end else - if ctrl.sneak == true and ctrl.jump == true then + --[[if ctrl.sneak == true and ctrl.jump == true then self._last_time_command = 0 --trasnfer the control to student airutils.transfer_control(self, true) - end + end]]-- end end ----------- @@ -353,16 +353,18 @@ function airutils.logic(self) -- end roll local pilot = player - if self._command_is_given and passenger then - pilot = passenger - else - self._command_is_given = false + if self._have_copilot then + if self._command_is_given and co_pilot then + pilot = co_pilot + else + self._command_is_given = false + end end ------------------------------------------------------ --accell calculation block ------------------------------------------------------ - if is_attached or passenger then + if is_attached or co_pilot then if self._autopilot ~= true then accel, stop = airutils.control(self, self.dtime, hull_direction, longit_speed, longit_drag, later_speed, later_drag, accel, pilot, is_flying) diff --git a/lib_planes/utilities.lua b/lib_planes/utilities.lua index bf88528..839e2dd 100644 --- a/lib_planes/utilities.lua +++ b/lib_planes/utilities.lua @@ -181,8 +181,8 @@ function airutils.dettach_pax(self, player) local name = player:get_player_name() --self._passenger -- passenger clicked the object => driver gets off the vehicle - if self._passenger == name then - self._passenger = nil + if self.co_pilot == name then + self.co_pilot = nil else local max_seats = table.getn(self._seats) for i = max_seats,1,-1