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
This commit is contained in:
HybridDog 2023-10-30 17:39:55 +01:00
parent 76708b02d5
commit 02d14a8970
1 changed files with 2 additions and 2 deletions

View File

@ -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