add 2 second wait on player join for flight checks
This commit is contained in:
parent
54260291cc
commit
4aec77aadf
45
flight.lua
45
flight.lua
@ -107,34 +107,39 @@ end
|
|||||||
-- on join / leave
|
-- on join / leave
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
|
||||||
if not player then return end
|
-- wait 2 seconds before doing flight checks on player
|
||||||
|
minetest.after(2.0, function(player)
|
||||||
|
|
||||||
-- get player name and timer
|
if not player then return end
|
||||||
local name = player:get_player_name()
|
|
||||||
local timer = get_timer(player)
|
|
||||||
|
|
||||||
-- if timer is blank and player can already fly then default and return
|
-- get player name and timer
|
||||||
if timer == "" and has_fly(name) then
|
local name = player:get_player_name()
|
||||||
|
local timer = get_timer(player)
|
||||||
|
|
||||||
set_timer(player, "-99")
|
-- if timer is blank and player can already fly then default and return
|
||||||
|
if timer == "" and has_fly(name) then
|
||||||
|
|
||||||
return
|
set_timer(player, "-99")
|
||||||
end
|
|
||||||
|
|
||||||
timer = tonumber(timer) or 0
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- if timer is set to default then return
|
timer = tonumber(timer) or 0
|
||||||
if timer == -99 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- if we got this far and player is flying then start countdown check
|
-- if timer is set to default then return
|
||||||
if has_fly(name) then
|
if timer == -99 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
minetest.after(timer_check, function()
|
-- if we got this far and player is flying then start countdown check
|
||||||
ethereal_set_flight(player)
|
if has_fly(name) then
|
||||||
end)
|
|
||||||
end
|
minetest.after(timer_check, function()
|
||||||
|
ethereal_set_flight(player)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
end, player)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user