Properly handle map items missing metadata

This commit is contained in:
Hugues Ross 2020-06-13 11:59:08 -04:00
parent c0e541a7e7
commit 675281b8c3

View File

@ -202,9 +202,20 @@ end
-- --
-- Returns the id of the new map -- Returns the id of the new map
local function map_from_meta(meta, player_x, player_z) local function map_from_meta(meta, player_x, player_z)
local size = meta:get_int("cartographer:size") or 10; local size = meta:get_int("cartographer:size");
local detail = meta:get_int("cartographer:detail") or 1; if size == 0 then
local scale = meta:get_int("cartographer:scale") or 1; size = 40;
end
local detail = meta:get_int("cartographer:detail");
if detail == 0 then
detail = 1;
end
local scale = meta:get_int("cartographer:scale");
if scale == 0 then
scale = 1;
end
local total_size = size * scale; local total_size = size * scale;