From e5fa9d6a28d654fc17477ce5ce91e58e335c9442 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sat, 22 Apr 2017 13:23:06 -0400 Subject: [PATCH] Lua cave mapgen: Maintain compatibility support for - in chamber locations --- data/lua/mapgen_helper.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/data/lua/mapgen_helper.lua b/data/lua/mapgen_helper.lua index 3c2686b5c1cc..2dfce6bdd64e 100644 --- a/data/lua/mapgen_helper.lua +++ b/data/lua/mapgen_helper.lua @@ -16,11 +16,19 @@ function mapgen_helper.random_location(x_list, y_list) if type(x_list) == "number" then x = x_list elseif type(x_list) == "string" then + local hyphen = x_list:find('-') + if hyphen then + x_list = x_list:sub(1, hyphen - 1) .. '..' .. x_list:sub(hyphen + 1) + end x = tonumber(helper.rand(x_list)) end if type(y_list) == "number" then y = y_list elseif type(y_list) == "string" then + local hyphen = y_list:find('-') + if hyphen then + y_list = y_list:sub(1, hyphen - 1) .. '..' .. y_list:sub(hyphen + 1) + end y = tonumber(helper.rand(y_list)) end return x or 0, y or 0