diff --git a/lib_planes/forms.lua b/lib_planes/forms.lua index 23a36fd..323b183 100644 --- a/lib_planes/forms.lua +++ b/lib_planes/forms.lua @@ -300,13 +300,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) local nodedef = minetest.registered_nodes[node_below] is_on_ground = not nodedef or nodedef.walkable or false -- unknown nodes are solid - if ent.driver_name == name then + if ent.driver_name == name and ent.owner == ent.driver_name then --just the owner can do this --minetest.chat_send_all(dump(noded)) if is_on_ground then --or clicker:get_player_control().sneak then + --minetest.chat_send_all(dump("is on ground")) --remove the passengers first local max_seats = table.getn(ent._seats) - for i = max_seats,2,-1 + for i = max_seats,1,-1 do + --minetest.chat_send_all("index: "..i.." - "..dump(ent._passengers[i])) if ent._passengers[i] then local passenger = minetest.get_player_by_name(ent._passengers[i]) if passenger then airutils.dettach_pax(ent, passenger) end @@ -324,7 +326,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end end airutils.dettachPlayer(ent, player) - else + elseif ent.owner == name then --just the owner too, but not driving + airutils.dettachPlayer(ent, player) + else --anyone airutils.dettach_pax(ent, player) end end diff --git a/lib_planes/utilities.lua b/lib_planes/utilities.lua index 6048f24..db5e324 100644 --- a/lib_planes/utilities.lua +++ b/lib_planes/utilities.lua @@ -121,7 +121,7 @@ function airutils.attach_pax(self, player, is_copilot) if is_copilot == true then if self.co_pilot == nil then self.co_pilot = name - + self._passengers[2] = name -- attach the driver player:set_attach(self.co_pilot_seat_base, "", {x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0}) player:set_eye_offset({x = 0, y = eye_y, z = 2}, {x = 0, y = 3, z = -30})