1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-22 23:10:17 +01:00

Verify node type is facedir.

This prevents nodes that are not of the "facedir" paramtype2,
as these are generally not expected to be able to rotate. Mods
and other methods may still manipulate param2 of these nodes
as expected.

Addresses #712
This commit is contained in:
Auke Kok 2015-12-24 12:41:52 -08:00 committed by paramat
parent b1e2ece638
commit 82299b94dc

View File

@ -35,6 +35,10 @@ local function screwdriver_handler(itemstack, user, pointed_thing, mode)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local ndef = minetest.registered_nodes[node.name] local ndef = minetest.registered_nodes[node.name]
-- verify node is facedir (expected to be rotatable)
if ndef.paramtype2 ~= "facedir" then
return
end
-- Compute param2 -- Compute param2
local rotationPart = node.param2 % 32 -- get first 4 bits local rotationPart = node.param2 % 32 -- get first 4 bits
local preservePart = node.param2 - rotationPart local preservePart = node.param2 - rotationPart