mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-22 10:53:43 +01:00
Fix error when closing a /craft formspec
Since 5.4.0-dev, hud_change() expects a valid HUD identifier. Nil results in an error. Additionally data.hud_flags were 'nil' after closing the /craft-opened formspec
This commit is contained in:
parent
1cd2bd21d7
commit
eeca37be0f
15
init.lua
15
init.lua
@ -1984,12 +1984,17 @@ on_receive_fields(function(player, formname, _f)
|
|||||||
local sb_rcp, sb_usg = _f.scrbar_rcp, _f.scrbar_usg
|
local sb_rcp, sb_usg = _f.scrbar_rcp, _f.scrbar_usg
|
||||||
|
|
||||||
if _f.quit then
|
if _f.quit then
|
||||||
player:hud_change(data.vignette, "text", "")
|
-- Neither the vignette nor hud_flags are available when /craft is used
|
||||||
data.vignette = nil
|
if data.vignette then
|
||||||
|
player:hud_change(data.vignette, "text", "")
|
||||||
|
data.vignette = nil
|
||||||
|
end
|
||||||
|
|
||||||
data.hud_flags.crosshair = true
|
if data.hud_flags then
|
||||||
player:hud_set_flags(data.hud_flags)
|
data.hud_flags.crosshair = true
|
||||||
data.hud_flags = nil
|
player:hud_set_flags(data.hud_flags)
|
||||||
|
data.hud_flags = nil
|
||||||
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user