mirror of
https://github.com/APercy/airutils.git
synced 2025-03-15 08:01:22 +00:00
fix to prevent nil player activating some methods
This commit is contained in:
parent
f5bd6ede7c
commit
ab0948a3f9
1 changed files with 5 additions and 1 deletions
|
@ -34,6 +34,7 @@ function airutils.get_gauge_angle(value, initial_angle)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function sit_player(player, name)
|
local function sit_player(player, name)
|
||||||
|
if not player then return end
|
||||||
if airutils.is_minetest then
|
if airutils.is_minetest then
|
||||||
player_api.player_attached[name] = true
|
player_api.player_attached[name] = true
|
||||||
player_api.set_animation(player, "sit")
|
player_api.set_animation(player, "sit")
|
||||||
|
@ -55,6 +56,7 @@ end
|
||||||
|
|
||||||
-- attach player
|
-- attach player
|
||||||
function airutils.attach(self, player, instructor_mode)
|
function airutils.attach(self, player, instructor_mode)
|
||||||
|
if not player then return end
|
||||||
if self._needed_licence then
|
if self._needed_licence then
|
||||||
local can_fly = minetest.check_player_privs(player, self._needed_licence)
|
local can_fly = minetest.check_player_privs(player, self._needed_licence)
|
||||||
if not can_fly then
|
if not can_fly then
|
||||||
|
@ -133,7 +135,7 @@ function airutils.check_passenger_is_attached(self, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function attach_copilot(self, name, player, eye_y)
|
local function attach_copilot(self, name, player, eye_y)
|
||||||
if not self.co_pilot_seat_base then return end
|
if not self.co_pilot_seat_base or not player then return end
|
||||||
self.co_pilot = name
|
self.co_pilot = name
|
||||||
self._passengers[2] = name
|
self._passengers[2] = name
|
||||||
-- attach the driver
|
-- attach the driver
|
||||||
|
@ -145,6 +147,7 @@ end
|
||||||
|
|
||||||
-- attach passenger
|
-- attach passenger
|
||||||
function airutils.attach_pax(self, player, is_copilot)
|
function airutils.attach_pax(self, player, is_copilot)
|
||||||
|
if not player then return end
|
||||||
local is_copilot = is_copilot or false
|
local is_copilot = is_copilot or false
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
||||||
|
@ -197,6 +200,7 @@ function airutils.attach_pax(self, player, is_copilot)
|
||||||
end
|
end
|
||||||
|
|
||||||
function airutils.dettach_pax(self, player, is_flying)
|
function airutils.dettach_pax(self, player, is_flying)
|
||||||
|
if not player then return end
|
||||||
is_flying = is_flying or false
|
is_flying = is_flying or false
|
||||||
local name = player:get_player_name() --self._passenger
|
local name = player:get_player_name() --self._passenger
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue