From 02d14a8970a6ca7cf6f79578da8f3081f63ab4b5 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Mon, 30 Oct 2023 17:39:55 +0100 Subject: [PATCH] Fix nether portal detection The function which calculates positions of an empty square currently has a bug: it returns the northeastern and southwestern corners twice and omits the northwestern and southeastern ones. This leads to a nether portal detection which is not rigorous enough, skipping eight nodes. This commit fixes the problem. Closes #13 --- nether/portal.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nether/portal.lua b/nether/portal.lua index 3589cc9..7f08a85 100644 --- a/nether/portal.lua +++ b/nether/portal.lua @@ -573,13 +573,13 @@ minetest.after(0.1, function() end) --- a not filled square +-- Get positions for an empty square around the origin local function vector_square(r) local tab, n = {}, 1 for i = -r+1, r do for j = -1, 1, 2 do local a, b = r*j, i*j - tab[n] = {a, b} + tab[n] = {a, -b} tab[n+1] = {b, a} n=n+2 end