Fix crash in remove_match_player when testing alone

master
shivajiva101 2020-09-05 22:24:59 +01:00 committed by GitHub
parent 9399bfaa11
commit 0d340571ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 10 deletions

View File

@ -460,19 +460,19 @@ local function remove_match_player(name)
key = eggwars.player[name]
match = eggwars.match[key]
player = match.player[name]
if player.egg then
minetest.remove_node(player.eggpos)
end
remove_player_hud(name)
count = match.alive - 1
match.alive = count
match.player[name].alive = false
match.player[name].egg = false
eggwars.match[key] = match
eggwars.player[name] = nil
if match.alive == 1 then
eggwars.end_match(key)
else
if player.egg then
minetest.remove_node(player.eggpos)
end
remove_player_hud(name)
count = match.alive - 1
match.alive = count
match.player[name].alive = false
match.player[name].egg = false
eggwars.match[key] = match
eggwars.player[name] = nil
player = minetest.get_player_by_name(name)
player:set_pos(lobby.pos)
local msg = name .. " quit the match!"