Fix teleporting when match finishes.
Minetest does not like telporting players from one function?
This commit is contained in:
parent
affc838437
commit
7d0026f790
@ -12,15 +12,17 @@ end
|
||||
|
||||
local stop_game = function()
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
local name = player:get_player_name()
|
||||
local privs = minetest.get_player_privs(name)
|
||||
privs.fast = nil
|
||||
privs.fly = nil
|
||||
privs.interact = nil
|
||||
privs.vote = true
|
||||
minetest.set_player_privs(name, privs)
|
||||
player:set_hp(20)
|
||||
spawning.spawn(player, "lobby")
|
||||
minetest.after(0.1, function()
|
||||
local name = player:get_player_name()
|
||||
local privs = minetest.get_player_privs(name)
|
||||
privs.fast = nil
|
||||
privs.fly = nil
|
||||
privs.interact = nil
|
||||
privs.vote = true
|
||||
minetest.set_player_privs(name, privs)
|
||||
player:set_hp(20)
|
||||
spawning.spawn(player, "lobby")
|
||||
end)
|
||||
end
|
||||
registrants = {}
|
||||
ingame = false
|
||||
@ -154,6 +156,10 @@ minetest.register_on_dieplayer(function(player)
|
||||
minetest.chat_send_player(name, "You are now spectating")
|
||||
end)
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
player:set_hp(1)
|
||||
end)
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
local privs = minetest.get_player_privs(name)
|
||||
|
@ -60,9 +60,6 @@ function spawning.spawn(player, place)
|
||||
local spawn = registered_spawns[place]
|
||||
if spawn then
|
||||
local pos = spawn.pos
|
||||
if player:get_player_control().sneak then
|
||||
minetest.after(1, spawning.spawn, {player, place})
|
||||
end
|
||||
player:setpos(pos)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user