Closed Megaf closed 6 years ago
Line 695 local set = vector.set_data_to_pos
but that vector function doesn't exist in bultin.
@paramat I do have this https://github.com/HybridDog/vector_extras
Best add that function to the nether mod, delete https://github.com/HybridDog/nether-pack/blob/master/nether/init.lua#L695 and replace it with:
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
Oh and do the same for lines 696 and 697 which likely cause similar crashes. Remember to remove the deprecation messages. The vector extras mod was updated without then updating the nether mod, this is why it's best to keep the nether mod self-contained.
Testing
In nether/init.lua replace line 696 with:
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
Replace line 697 with:
local function remove(tab, z,y,x)
if get(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
Seems my suggestion above is causing problems, i can't be bothered to attend to this anymore. @HybridDog over to you.
I removed these functions from vector_extras because they're inefficient. When I made them I didn't know yet that moving things from and to memory is a lot slower than calculating and I didn't know how the lua table is implemented. tab[z][y][x] is implemented as three hash maps and their three hash value calculations, whereas tab[minetest.hash_node_position(pos)] rather represents one hashmap and two hash value calculations. # The proper fix is using tab[minetest.has_node_position{x=x, y=y, z=z}] instead of set and get everywhere.
Well, now that these thing were fixed my fork doenst have a reason to exist. Will test how nether-pack is doing and if everything is fine I will delete my fork.
@HybridDog Thanks for sorting this out. @paramat Thanks for all the help and help in getting my server going again. Closing this now, will reopen if bug still present.