improved ship dettach

This commit is contained in:
Alexsandro Percy 2024-03-03 03:56:07 -03:00
parent 060b2fac5b
commit 5c81cc7858
2 changed files with 5 additions and 4 deletions

View file

@ -256,8 +256,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
-- dettach player -- dettach player
--========================= --=========================
-- eject passenger if the plane is on ground -- eject passenger if the plane is on ground
ent.driver_name = nil
ent._at_control = false
ap_airship.dettach_pax(ent, player, "l") ap_airship.dettach_pax(ent, player, "l")
@ -267,8 +265,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
-- dettach player -- dettach player
--========================= --=========================
-- eject passenger if the plane is on ground -- eject passenger if the plane is on ground
ent.driver_name = nil
ent._at_control = false
ap_airship.dettach_pax(ent, player, "r") ap_airship.dettach_pax(ent, player, "r")

View file

@ -185,6 +185,11 @@ function ap_airship.dettach_pax(self, player, side)
if not self._passengers then return end if not self._passengers then return end
if player then if player then
local name = player:get_player_name() --self._passenger local name = player:get_player_name() --self._passenger
if self.driver_name == name then
self.driver_name = nil
self._at_control = false
end
ap_airship.remove_hud(player) ap_airship.remove_hud(player)
-- passenger clicked the object => driver gets off the vehicle -- passenger clicked the object => driver gets off the vehicle