From f6890e5ed0303b14a8c5ee3866018dcc5bd4513e Mon Sep 17 00:00:00 2001 From: cheapie Date: Sat, 24 Nov 2018 19:47:57 -0600 Subject: [PATCH] Fix noteblocks responding to get_sounds on every channel --- noteblock.lua | 7 ++++--- 1 file 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