Merge pull request #25 from Ocraw/main

Check to prevent wap from opening on chests
This commit is contained in:
ZenonSeth 2024-08-24 22:15:00 +01:00 committed by GitHub
commit 6381cee6eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,6 +50,16 @@ end
local function on_wireless_pad_secondary(itemstack, placer, pointed_thing)
if not placer or not placer:is_player() then return end
-- Make sure the wap doesn't open if clicking on a node with on_rightclick function
-- unless sneak is pressed.
if pointed_thing.type == "node" then
local node = minetest.get_node(pointed_thing.under)
if not placer:get_player_control().sneak and node then
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
end
end
end
local playerName = placer:get_player_name()
local itemMeta = itemstack:get_meta()