Skip to content

Commit

Permalink
Fix cable plate placing on several-blocks nodes (#358)
Browse files Browse the repository at this point in the history
Co-authored-by: SX <[email protected]>
  • Loading branch information
Athozus and S-S-X authored Apr 14, 2024
1 parent e699d32 commit ad2c11e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions technic/machines/register/cables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,20 @@ function technic.register_cable_plate(nodename, data)
def.node_box["connect_"..notconnects[i]] = nil
if i == 1 then
def.on_place = function(itemstack, placer, pointed_thing)
local pointed_thing_diff = vector.subtract(pointed_thing.above, pointed_thing.under)
local count = 0
for axis in pairs(xyz) do
count = count + (pointed_thing.under[axis] == pointed_thing.above[axis] and 0 or 1)
if count > 1 then
return itemstack
end
end
local pointed_thing_diff = vector.direction(pointed_thing.under, pointed_thing.above)
local index = pointed_thing_diff.x + (pointed_thing_diff.y*2) + (pointed_thing_diff.z*3)
local num = index < 0 and -index + 3 or index
local crtl = placer:get_player_control()
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)
fine_pointed = vector.direction(pointed_thing.above,fine_pointed)
fine_pointed[xyz[index < 0 and -index or index]] = nil
local key_a, a = next(fine_pointed)
local key_b, b = next(fine_pointed, key_a)
Expand Down

0 comments on commit ad2c11e

Please sign in to comment.