Skip to content

Commit 66b3116

Browse files
author
blut
committed
fix impercise piston orientation. piston placement used to be finicky and not map correctly to the viewing angle
1 parent b66cf10 commit 66b3116

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

mesecons_pistons/init.lua

+1-14
Original file line numberDiff line numberDiff line change
@@ -115,27 +115,14 @@ local function piston_off(pos, node)
115115
end
116116
end
117117

118-
local orientations = {
119-
[0] = { 4, 8},
120-
{13, 17},
121-
{10, 6},
122-
{20, 15},
123-
}
124-
125118
local function piston_orientate(pos, placer)
126119
mesecon.mvps_set_owner(pos, placer)
127120
if not placer then
128121
return
129122
end
130123
local pitch = math.deg(placer:get_look_vertical())
131124
local node = minetest.get_node(pos)
132-
if pitch > 55 then
133-
node.param2 = orientations[node.param2][1]
134-
elseif pitch < -55 then
135-
node.param2 = orientations[node.param2][2]
136-
else
137-
return
138-
end
125+
node.param2 = core.dir_to_facedir(placer:get_look_dir(), true)
139126
minetest.swap_node(pos, node)
140127
-- minetest.after, because on_placenode for unoriented piston must be processed first
141128
minetest.after(0, mesecon.on_placenode, pos, node)

0 commit comments

Comments
 (0)