Fix potential issue with progressive mode

This commit is contained in:
Jean-Patrick Guerrero 2021-07-05 03:21:04 +02:00
parent 0ab3dd5ffa
commit 4ca50e846d

View File

@ -3273,6 +3273,7 @@ if progressive_mode then
local player = players[i] local player = players[i]
local name = player:get_player_name() local name = player:get_player_name()
local data = pdata[name] local data = pdata[name]
if not data then return end
local inv_items = get_inv_items(player) local inv_items = get_inv_items(player)
local diff = array_diff(inv_items, data.inv_items) local diff = array_diff(inv_items, data.inv_items)
@ -3308,7 +3309,7 @@ if progressive_mode then
local name = player:get_player_name() local name = player:get_player_name()
local data = pdata[name] local data = pdata[name]
if data.show_hud ~= nil and singleplayer then if data and data.show_hud ~= nil and singleplayer then
show_hud_success(player, data) show_hud_success(player, data)
end end
end end
@ -3319,6 +3320,7 @@ if progressive_mode then
core.register_on_joinplayer(function(player) core.register_on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
local data = pdata[name] local data = pdata[name]
if not data then return end
data.inv_items = data.inv_items or {} data.inv_items = data.inv_items or {}
data.known_recipes = data.known_recipes or 0 data.known_recipes = data.known_recipes or 0