Fix achievements menu aggressively taking over

This commit is contained in:
Wuzzy 2019-09-01 14:49:01 +02:00
parent 5a804e9adc
commit 74c225573f

View File

@ -283,25 +283,37 @@ end
local function receive_fields(player, form_name, fields) local function receive_fields(player, form_name, fields)
local name = player:get_player_name() local name = player:get_player_name()
if form_name ~= "achievements:achievements" and form_name ~= "" then return end local in_achievements_menu = false
if form_name == "achievements:achievements" then
if fields.quit then return end in_achievements_menu = true
elseif form_name ~= "" then
return
end
if fields.quit then
return
end
local selected = 1 local selected = 1
if fields.tab_achievements then
in_achievements_menu = true
end
if fields.achievement_list then if fields.achievement_list then
in_achievements_menu = true
local selection = minetest.explode_table_event(fields.achievement_list) local selection = minetest.explode_table_event(fields.achievement_list)
if selection.type == "CHG" or selection.type == "DCL" then if selection.type == "CHG" or selection.type == "DCL" then
selected = selection.row selected = selection.row
end end
end
minetest.show_formspec( end
name, if in_achievements_menu then
"achievements:achievements", minetest.show_formspec(
achievements.get_formspec(name, selected) name,
) "achievements:achievements",
achievements.get_formspec(name, selected)
)
end
end end
minetest.register_on_player_receive_fields(receive_fields) minetest.register_on_player_receive_fields(receive_fields)