Fix bug in get_node_lvm()

This commit is contained in:
Joachim Stolberg 2020-12-15 16:09:22 +01:00
parent fce21d9cf8
commit bd8bcce7b2
2 changed files with 15 additions and 11 deletions

@ -84,12 +84,14 @@ function Tube:get_node_lvm(pos)
local data = vm:get_data()
local param2_data = vm:get_param2_data()
local area = VoxelArea:new({MinEdge = MinEdge, MaxEdge = MaxEdge})
local idx = area:index(pos.x, pos.y, pos.z)
node = {
name = minetest.get_name_from_content_id(data[idx]),
param2 = param2_data[idx]
}
return node
local idx = area:indexp(pos)
if data[idx] and param2_data[idx] then
return {
name = minetest.get_name_from_content_id(data[idx]),
param2 = param2_data[idx]
}
end
return {name="ignore", param2=0}
end
-- Read param2 from a primary node at the given position.

@ -59,11 +59,13 @@ function tubelib2.get_node_lvm(pos)
local param2_data = vm:get_param2_data()
local area = VoxelArea:new({MinEdge = MinEdge, MaxEdge = MaxEdge})
local idx = area:indexp(pos)
node = {
name = minetest.get_name_from_content_id(data[idx]),
param2 = param2_data[idx]
}
return node
if data[idx] and param2_data[idx] then
return {
name = minetest.get_name_from_content_id(data[idx]),
param2 = param2_data[idx]
}
end
return {name="ignore", param2=0}
end
local function update1(self, pos, dir)