From 6be62b6660ff306706125b035ec0bc81b872f7c6 Mon Sep 17 00:00:00 2001 From: y Date: Thu, 16 May 2019 23:03:36 +0100 Subject: [PATCH] set correct defaults if quarry depth and startlevel are not set --- tubelib_addons1/quarry.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tubelib_addons1/quarry.lua b/tubelib_addons1/quarry.lua index 6bfbaa5..cd5a3dc 100644 --- a/tubelib_addons1/quarry.lua +++ b/tubelib_addons1/quarry.lua @@ -36,8 +36,10 @@ local Level2Idx = {[2]=1, [1]=2, [0]=3, [-1]=4, [-2]=5, [-3]=6, [-5]=7, [-10]=8, [-15]=9, [-20]=10} local function formspec(self, pos, meta) - local depth = meta:get_int("max_levels") or 1 - local start_level = meta:get_int("start_level") or 1 + local depth = meta:get_int("max_levels") + if not Depth2Idx[depth] then depth = 1 end + local start_level = meta:get_int("start_level") + if not Level2Idx[start_level] then start_level = 0 end local endless = meta:get_int("endless") or 0 local fuel = meta:get_int("fuel") or 0 -- some recalculations