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
1 changed files with 14 additions and 3 deletions

View File

@ -202,9 +202,20 @@ end
--
-- Returns the id of the new map
local function map_from_meta(meta, player_x, player_z)
local size = meta:get_int("cartographer:size") or 10;
local detail = meta:get_int("cartographer:detail") or 1;
local scale = meta:get_int("cartographer:scale") or 1;
local size = meta:get_int("cartographer:size");
if size == 0 then
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;