Fix maps in a very lame way

This commit is contained in:
kay27 2022-02-19 06:52:51 +04:00
parent 957a831dbf
commit 17c30de74a
1 changed files with 9 additions and 3 deletions

View File

@ -140,16 +140,22 @@ function mcl_maps.create_map(pos)
return itemstack return itemstack
end end
local loading_maps = {}
function mcl_maps.load_map(id) function mcl_maps.load_map(id)
if id == "" or creating_maps[id] then if id == "" or creating_maps[id] or loading_maps[id] then
return return
end end
local texture = "mcl_maps_map_texture_" .. id .. ".png" local texture = "mcl_maps_map_texture_" .. id .. ".png"
if not loaded_maps[id] then if not loaded_maps[id] then
loading_maps[id] = true
minetest.dynamic_add_media({filepath = map_textures_path .. texture, ephemeral = true}, function(player_name)
loaded_maps[id] = true loaded_maps[id] = true
minetest.dynamic_add_media(map_textures_path .. texture, function() end) loading_maps[id] = nil
end)
return
end end
return texture return texture