Skip to content

Commit

Permalink
Fix out-of-range indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
Athozus committed Apr 1, 2024
1 parent f85db6e commit 8e655f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion technic/machines/register/cables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ function technic.register_cable_plate(nodename, data)
if (crtl.aux1 or crtl.sneak) and not (crtl.aux1 and crtl.sneak) and index ~= 0 then
local fine_pointed = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
fine_pointed = vector.subtract(fine_pointed, pointed_thing.above)
index = index < 0 and -index or index
index = (index-1)%3+1
fine_pointed[xyz[index < 0 and -index or index]] = nil
fine_pointed[xyz[index]] = nil
local key_a, a = next(fine_pointed)
local key_b, b = next(fine_pointed, key_a)
local far_key = math.abs(a) > math.abs(b) and key_a or key_b
Expand Down

0 comments on commit 8e655f0

Please sign in to comment.