Fix crash in issue #3

This commit is contained in:
MrRar 2024-12-21 11:15:47 -06:00
parent a56b8dc3ff
commit 8d17ce238d

View File

@ -277,6 +277,15 @@ minetest.register_entity("edit:preview_node", {
local function hide_paste_preview(player) local function hide_paste_preview(player)
local d = edit.player_data[player] local d = edit.player_data[player]
player:hud_remove(d.paste_preview_hud)
d.paste_preview_hud = nil
if not d.paste_preview.object:get_pos() then
edit.delete_paste_preview(player)
return
end
--d.paste_preview:set_properties({is_visible = false}) --d.paste_preview:set_properties({is_visible = false})
-- This does not work right. -- This does not work right.
-- Some child entities do not become visable when you set is_visable back to true -- Some child entities do not become visable when you set is_visable back to true
@ -285,8 +294,6 @@ local function hide_paste_preview(player)
objref:set_properties({is_visible = false}) objref:set_properties({is_visible = false})
end end
d.paste_preview.object:set_attach(player) d.paste_preview.object:set_attach(player)
player:hud_remove(d.paste_preview_hud)
d.paste_preview_hud = nil
end end
local function show_paste_preview(player) local function show_paste_preview(player)