Fix crashes on quest abort/accept when HUD is hidden
This commit is contained in:
parent
0de375a4ab
commit
8f10e93bc3
20
core.lua
20
core.lua
@ -513,10 +513,12 @@ function quests.accept_quest(playername, questname)
|
|||||||
quests.successfull_quests[playername][questname] = {count = 1}
|
quests.successfull_quests[playername][questname] = {count = 1}
|
||||||
end
|
end
|
||||||
quests.active_quests[playername][questname].finished = true
|
quests.active_quests[playername][questname].finished = true
|
||||||
for _,quest in ipairs(quests.hud[playername].list) do
|
if quests.hud[playername].list ~= nil then -- nil when HUD is hidden
|
||||||
if quest.name == questname then
|
for _,quest in ipairs(quests.hud[playername].list) do
|
||||||
local player = minetest.get_player_by_name(playername)
|
if quest.name == questname then
|
||||||
player:hud_change(quest.id, "number", quests.colors.success)
|
local player = minetest.get_player_by_name(playername)
|
||||||
|
player:hud_change(quest.id, "number", quests.colors.success)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
handle_quest_end(playername, questname)
|
handle_quest_end(playername, questname)
|
||||||
@ -551,10 +553,12 @@ function quests.abort_quest(playername, questname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
quests.active_quests[playername][questname].finished = true
|
quests.active_quests[playername][questname].finished = true
|
||||||
for _,quest in ipairs(quests.hud[playername].list) do
|
if quests.hud[playername].list ~= nil then -- nil when HUD is hidden
|
||||||
if quest.name == questname then
|
for _,quest in ipairs(quests.hud[playername].list) do
|
||||||
local player = minetest.get_player_by_name(playername)
|
if quest.name == questname then
|
||||||
player:hud_change(quest.id, "number", quests.colors.failed)
|
local player = minetest.get_player_by_name(playername)
|
||||||
|
player:hud_change(quest.id, "number", quests.colors.failed)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user