mirror of
https://github.com/APercy/airutils.git
synced 2025-03-21 18:41:21 +00:00
fixed copilot drop
This commit is contained in:
parent
1b8caaf7c4
commit
32ba21c3fd
2 changed files with 8 additions and 4 deletions
|
@ -300,13 +300,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local nodedef = minetest.registered_nodes[node_below]
|
local nodedef = minetest.registered_nodes[node_below]
|
||||||
is_on_ground = not nodedef or nodedef.walkable or false -- unknown nodes are solid
|
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))
|
--minetest.chat_send_all(dump(noded))
|
||||||
if is_on_ground then --or clicker:get_player_control().sneak then
|
if is_on_ground then --or clicker:get_player_control().sneak then
|
||||||
|
--minetest.chat_send_all(dump("is on ground"))
|
||||||
--remove the passengers first
|
--remove the passengers first
|
||||||
local max_seats = table.getn(ent._seats)
|
local max_seats = table.getn(ent._seats)
|
||||||
for i = max_seats,2,-1
|
for i = max_seats,1,-1
|
||||||
do
|
do
|
||||||
|
--minetest.chat_send_all("index: "..i.." - "..dump(ent._passengers[i]))
|
||||||
if ent._passengers[i] then
|
if ent._passengers[i] then
|
||||||
local passenger = minetest.get_player_by_name(ent._passengers[i])
|
local passenger = minetest.get_player_by_name(ent._passengers[i])
|
||||||
if passenger then airutils.dettach_pax(ent, passenger) end
|
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
|
||||||
end
|
end
|
||||||
airutils.dettachPlayer(ent, player)
|
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)
|
airutils.dettach_pax(ent, player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -121,7 +121,7 @@ function airutils.attach_pax(self, player, is_copilot)
|
||||||
if is_copilot == true then
|
if is_copilot == true then
|
||||||
if self.co_pilot == nil then
|
if self.co_pilot == nil then
|
||||||
self.co_pilot = name
|
self.co_pilot = name
|
||||||
|
self._passengers[2] = name
|
||||||
-- attach the driver
|
-- 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_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})
|
player:set_eye_offset({x = 0, y = eye_y, z = 2}, {x = 0, y = 3, z = -30})
|
||||||
|
|
Loading…
Add table
Reference in a new issue