summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorauouymous <5005204+auouymous@users.noreply.github.com>2020-11-12 11:26:02 -0700
committerGitHub <noreply@github.com>2020-11-12 19:26:02 +0100
commit0d86f2c45eee3382e59652fce678d9c39a677d77 (patch)
tree94d5623a2d9bcf4e5db6d14b52251cf88fabb330
parentd356f901a3c26f2cce28ce0be64d26fff996e110 (diff)
downloadmesecons-0d86f2c45eee3382e59652fce678d9c39a677d77.tar
mesecons-0d86f2c45eee3382e59652fce678d9c39a677d77.tar.gz
mesecons-0d86f2c45eee3382e59652fce678d9c39a677d77.tar.bz2
mesecons-0d86f2c45eee3382e59652fce678d9c39a677d77.tar.xz
mesecons-0d86f2c45eee3382e59652fce678d9c39a677d77.zip
Prevent unauthorized players from changing the noteblock sound. (#547)
-rw-r--r--mesecons_noteblock/init.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/mesecons_noteblock/init.lua b/mesecons_noteblock/init.lua
index d29ab88..577cee0 100644
--- a/mesecons_noteblock/init.lua
+++ b/mesecons_noteblock/init.lua
@@ -3,7 +3,11 @@ minetest.register_node("mesecons_noteblock:noteblock", {
tiles = {"mesecons_noteblock.png"},
is_ground_content = false,
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
- on_punch = function(pos, node) -- change sound when punched
+ on_punch = function(pos, node, puncher) -- change sound when punched
+ if minetest.is_protected(pos, puncher and puncher:get_player_name()) then
+ return
+ end
+
node.param2 = (node.param2+1)%12
mesecon.noteblock_play(pos, node.param2)
minetest.set_node(pos, node)