summaryrefslogtreecommitdiff
path: root/noteblock.lua
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2018-11-24 19:47:57 -0600
committercheapie <no-email-for-you@example.com>2018-11-24 19:47:57 -0600
commitf6890e5ed0303b14a8c5ee3866018dcc5bd4513e (patch)
tree1b497de7117b5fde701b6d278372cf32600b5066 /noteblock.lua
parent97765470fc876e73ad6f2e6b547bf2fc7233a562 (diff)
downloaddigistuff-f6890e5ed0303b14a8c5ee3866018dcc5bd4513e.tar
digistuff-f6890e5ed0303b14a8c5ee3866018dcc5bd4513e.tar.gz
digistuff-f6890e5ed0303b14a8c5ee3866018dcc5bd4513e.tar.bz2
digistuff-f6890e5ed0303b14a8c5ee3866018dcc5bd4513e.tar.xz
digistuff-f6890e5ed0303b14a8c5ee3866018dcc5bd4513e.zip
Fix noteblocks responding to get_sounds on every channel
Diffstat (limited to 'noteblock.lua')
-rw-r--r--noteblock.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/noteblock.lua b/noteblock.lua
index 4aa1213..f2e9c89 100644
--- a/noteblock.lua
+++ b/noteblock.lua
@@ -35,16 +35,17 @@ minetest.register_node("digistuff:noteblock", {
receptor = {},
effector = {
action = function(pos,node,channel,msg)
+ local meta = minetest.get_meta(pos)
+ local setchan = meta:get_string("channel")
+ if channel ~= setchan then return end
if msg == "get_sounds" then
local soundnames = {}
for i in pairs(validnbsounds) do
table.insert(soundnames,i)
end
digiline:receptor_send(pos, digiline.rules.default, channel, soundnames)
+ return
end
- local meta = minetest.get_meta(pos)
- local setchan = meta:get_string("channel")
- if channel ~= setchan then return end
if type(msg) == "string" then
local sound = validnbsounds[msg]
if sound then minetest.sound_play(sound,{pos=pos}) end