From 225bf51c8536f790409c1066bfffdd6068afb953 Mon Sep 17 00:00:00 2001 From: Megaf Date: Wed, 20 Dec 2017 14:12:12 -0200 Subject: [PATCH 1/3] Fixes https://github.com/HybridDog/nether-pack/issues/6 ``` Use: local tab = minetest.wrap_text(content, guide_size.fx, true) Needs 3rd argument 'true' to ensure 'tab' is a table. See https://github.com/minetest/minetest/blob/649eef9e4fe4ef6a59ca9f59c900c6e0900cfb3a/builtin/common/misc_helpers.lua#L311 ``` --- nether/guide.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nether/guide.lua b/nether/guide.lua index 7af5748..6eee44e 100644 --- a/nether/guide.lua +++ b/nether/guide.lua @@ -315,7 +315,7 @@ for n,data in ipairs(guide_infos) do elseif typ == "x" then x = math.max(x, content) elseif typ == "text" then - local tab = minetest.wrap_text(content, guide_size.fx) + local tab = minetest.wrap_text(content, guide_size.fx, true) local l = guide_size.cx for _,str in ipairs(tab) do form = form.."label["..guide_size.cx ..","..guide_size.cy+y..";"..str.."]" From 43bf49648f5e63c4cd7f9f56da06ad8c83d9fdee Mon Sep 17 00:00:00 2001 From: Megaf Date: Wed, 20 Dec 2017 15:45:51 -0200 Subject: [PATCH 2/3] Added functions from vector_extras to nether mod. Thanks @paramat. Fixes #7 In theory, needs testing. --- nether/init.lua | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/nether/init.lua b/nether/init.lua index e8381f2..5cf93e8 100644 --- a/nether/init.lua +++ b/nether/init.lua @@ -691,10 +691,40 @@ function nether.grow_netherstructure(pos, generated) set_vm_data(manip, nodes, pos, t1, "blood", generated) end +local function set(tab, z,y,x, data) + if tab[z] then + if tab[z][y] then + tab[z][y][x] = data + return + end + tab[z][y] = {[x] = data} + return + end + tab[z] = {[y] = {[x] = data}} +end -local set = vector.set_data_to_pos -local get = vector.get_data_from_pos -local remove = vector.remove_data_from_pos +local function get(tab, z,y,x) + local data = tab[z] + if data then + data = data[y] + if data then + return data[x] + end + end +end + +local function remove(tab, z,y,x) + if vector.get_data_from_pos(tab, z,y,x) == nil then + return + end + tab[z][y][x] = nil + if not next(tab[z][y]) then + tab[z][y] = nil + end + if not next(tab[z]) then + tab[z] = nil + end +end local function soft_node(id) return id == c.air or id == c.ignore From c1f2375254d1c19f4c6b2e43093f4d846540782e Mon Sep 17 00:00:00 2001 From: Megaf Date: Wed, 20 Dec 2017 18:44:53 -0200 Subject: [PATCH 3/3] Update init.lua --- nether/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nether/init.lua b/nether/init.lua index 5cf93e8..034ff37 100644 --- a/nether/init.lua +++ b/nether/init.lua @@ -714,7 +714,7 @@ local function get(tab, z,y,x) end local function remove(tab, z,y,x) - if vector.get_data_from_pos(tab, z,y,x) == nil then + if get(tab, z,y,x) == nil then return end tab[z][y][x] = nil