Don't override param2 bits that are not used for rotation in screwdriver
This commit is contained in:
parent
854415fd33
commit
1237bc3a4b
@ -37,16 +37,18 @@ local function screwdriver_handler(itemstack, user, pointed_thing, mode)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Set param2
|
-- Set param2
|
||||||
local n = node.param2
|
local rotationPart = node.param2 % 32 -- get first 4 bits
|
||||||
local axisdir = math.floor(n / 4)
|
local preservePart = node.param2 - rotationPart
|
||||||
local rotation = n - axisdir * 4
|
|
||||||
|
local axisdir = math.floor(rotationPart / 4)
|
||||||
|
local rotation = rotationPart - axisdir * 4
|
||||||
if mode == ROTATE_FACE then
|
if mode == ROTATE_FACE then
|
||||||
n = axisdir * 4 + nextrange(rotation, 3)
|
rotationPart = axisdir * 4 + nextrange(rotation, 3)
|
||||||
elseif mode == ROTATE_AXIS then
|
elseif mode == ROTATE_AXIS then
|
||||||
n = nextrange(axisdir, 5) * 4
|
rotationPart = nextrange(axisdir, 5) * 4
|
||||||
end
|
end
|
||||||
|
|
||||||
node.param2 = n
|
node.param2 = preservePart + rotationPart
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
|
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
Loading…
Reference in New Issue
Block a user