Skip to content

Commit

Permalink
Add diagonal placement check
Browse files Browse the repository at this point in the history
  • Loading branch information
Athozus authored and S-S-X committed Apr 14, 2024
1 parent d0cbd7d commit ba01522
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions technic/machines/register/cables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ 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 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
Expand Down

0 comments on commit ba01522

Please sign in to comment.