mirror of
https://github.com/MinetestForFun/quests.git
synced 2025-01-10 02:00:24 +01:00
Fix crashes on quest abort/accept when HUD is hidden
This commit is contained in:
parent
0de375a4ab
commit
8f10e93bc3
4
core.lua
4
core.lua
@ -513,12 +513,14 @@ function quests.accept_quest(playername, questname)
|
||||
quests.successfull_quests[playername][questname] = {count = 1}
|
||||
end
|
||||
quests.active_quests[playername][questname].finished = true
|
||||
if quests.hud[playername].list ~= nil then -- nil when HUD is hidden
|
||||
for _,quest in ipairs(quests.hud[playername].list) do
|
||||
if quest.name == questname then
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
player:hud_change(quest.id, "number", quests.colors.success)
|
||||
end
|
||||
end
|
||||
end
|
||||
handle_quest_end(playername, questname)
|
||||
quests.show_message("success", playername, S("Quest completed:") .. " " .. quests.registered_quests[questname].title)
|
||||
minetest.after(3, function(playername, questname)
|
||||
@ -551,12 +553,14 @@ function quests.abort_quest(playername, questname)
|
||||
end
|
||||
|
||||
quests.active_quests[playername][questname].finished = true
|
||||
if quests.hud[playername].list ~= nil then -- nil when HUD is hidden
|
||||
for _,quest in ipairs(quests.hud[playername].list) do
|
||||
if quest.name == questname then
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
player:hud_change(quest.id, "number", quests.colors.failed)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local quest = quests.registered_quests[questname]
|
||||
quest.abortcallback(playername, questname, quests.active_quests[playername][questname].metadata)
|
||||
|
Loading…
Reference in New Issue
Block a user