From 675281b8c3d6f8cd4b1b27b4d663bb24baad7d03 Mon Sep 17 00:00:00 2001 From: Hugues Ross Date: Sat, 13 Jun 2020 11:59:08 -0400 Subject: [PATCH] Properly handle map items missing metadata --- items.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/items.lua b/items.lua index 18d7fd5..c23cfb3 100644 --- a/items.lua +++ b/items.lua @@ -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;