Properly update map item meta

This commit is contained in:
Nils Dagsson Moskopp 2022-05-20 15:33:40 +02:00
parent 6cb1b4cd64
commit 458e9dd87d
Signed by untrusted user who does not match committer: erlehmann
GPG Key ID: A3BC671C35191080
1 changed files with 8 additions and 7 deletions

View File

@ -456,10 +456,6 @@ maps.load_map_item = function(itemstack)
return
end
if maps.load[map_id] then
return maps.load_map(map_id)
end
local texture_file_name = maps.get_map_filename(map_id)
local texture_file_path = textures_dir .. texture_file_name
@ -522,7 +518,7 @@ maps.load_map_item = function(itemstack)
assert(
minetest.safe_file_write(
texture_file_path,
decode_item_meta(tga_deflate_base64)
maps.decode_map_item_meta(tga_deflate_base64)
)
)
else
@ -534,7 +530,8 @@ maps.load_map_item = function(itemstack)
end
end
return maps.load_map(map_id)
local texture = maps.load_map(map_id)
return texture, itemstack
end
minetest.register_on_joinplayer(
@ -558,7 +555,7 @@ minetest.register_on_joinplayer(
maps.show_map_hud = function(player)
local wield_item = player:get_wielded_item()
local texture = maps.load_map_item(wield_item)
local texture, updated_wield_item = maps.load_map_item(wield_item)
local player_pos = player:get_pos()
local player_name = player:get_player_name()
@ -580,6 +577,10 @@ maps.show_map_hud = function(player)
return
end
if updated_wield_item then
player:set_wielded_item(updated_wield_item)
end
local pos = vector.round(player_pos)
local meta = wield_item:get_meta()