diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/init.lua b/mods/ITEMS/REDSTONE/mesecons_noteblock/init.lua index cae65d7561..73440e2cf3 100644 --- a/mods/ITEMS/REDSTONE/mesecons_noteblock/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_noteblock/init.lua @@ -12,10 +12,9 @@ minetest.register_node("mesecons_noteblock:noteblock", { minetest.add_node(pos, {name="mesecons_noteblock:noteblock", param2=0}) end, on_rightclick = function (pos, node) -- change sound when punched - local param2 = node.param2+1 - if param2==12 then param2=0 end - minetest.add_node(pos, {name = node.name, param2 = param2}) - mesecon.noteblock_play(pos, param2) + node.param2 = (node.param2+1)%24 + mesecon.noteblock_play(pos, node.param2) + minetest.set_node(pos, node) end, sounds = mcl_sounds.node_sound_wood_defaults(), mesecons = {effector = { -- play sound when activated @@ -42,34 +41,41 @@ minetest.register_craft({ burntime = 15 }) +local soundnames_piano = { + [0] = "mesecons_noteblock_c", + "mesecons_noteblock_csharp", + "mesecons_noteblock_d", + "mesecons_noteblock_dsharp", + "mesecons_noteblock_e", + "mesecons_noteblock_f", + "mesecons_noteblock_fsharp", + "mesecons_noteblock_g", + "mesecons_noteblock_gsharp", + "mesecons_noteblock_a", + "mesecons_noteblock_asharp", + "mesecons_noteblock_b", + + "mesecons_noteblock_c2", + "mesecons_noteblock_csharp2", + "mesecons_noteblock_d2", + "mesecons_noteblock_dsharp2", + "mesecons_noteblock_e2", + "mesecons_noteblock_f2", + "mesecons_noteblock_fsharp2", + "mesecons_noteblock_g2", + "mesecons_noteblock_gsharp2", + "mesecons_noteblock_a2", + "mesecons_noteblock_asharp2", + "mesecons_noteblock_b2", + +} + mesecon.noteblock_play = function (pos, param2) local soundname - -- TODO: 24 piano notes - if param2==8 then - soundname="mesecons_noteblock_a" - elseif param2==9 then - soundname="mesecons_noteblock_asharp" - elseif param2==10 then - soundname="mesecons_noteblock_b" - elseif param2==11 then - soundname="mesecons_noteblock_c" - elseif param2==0 then - soundname="mesecons_noteblock_csharp" - elseif param2==1 then - soundname="mesecons_noteblock_d" - elseif param2==2 then - soundname="mesecons_noteblock_dsharp" - elseif param2==3 then - soundname="mesecons_noteblock_e" - elseif param2==4 then - soundname="mesecons_noteblock_f" - elseif param2==5 then - soundname="mesecons_noteblock_fsharp" - elseif param2==6 then - soundname="mesecons_noteblock_g" - elseif param2==7 then - soundname="mesecons_noteblock_gsharp" - end + + -- Default: One of 24 piano notes + soundname = soundnames_piano[param2] + local block_below_name = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name if minetest.get_item_group(block_below_name, "material_glass") ~= 0 then -- TODO: Sticks and clicks diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_a2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_a2.ogg new file mode 100644 index 0000000000..695b0f4eba Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_a2.ogg differ diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_asharp2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_asharp2.ogg new file mode 100644 index 0000000000..27bd09df8e Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_asharp2.ogg differ diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_b2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_b2.ogg new file mode 100644 index 0000000000..3de1250df4 Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_b2.ogg differ diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_c2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_c2.ogg new file mode 100644 index 0000000000..724db7ded1 Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_c2.ogg differ diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_csharp2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_csharp2.ogg new file mode 100644 index 0000000000..fc7f6c883f Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_csharp2.ogg differ diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_d2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_d2.ogg new file mode 100644 index 0000000000..dfd702b11f Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_d2.ogg differ diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_dsharp2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_dsharp2.ogg new file mode 100644 index 0000000000..5ac16ddec2 Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_dsharp2.ogg differ diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_e2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_e2.ogg new file mode 100644 index 0000000000..1dcc0c4a5b Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_e2.ogg differ diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_f2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_f2.ogg new file mode 100644 index 0000000000..acf10dbb93 Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_f2.ogg differ diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_fsharp2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_fsharp2.ogg new file mode 100644 index 0000000000..a96f637104 Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_fsharp2.ogg differ diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_g2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_g2.ogg new file mode 100644 index 0000000000..917b2b9cd2 Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_g2.ogg differ diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_gsharp2.ogg b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_gsharp2.ogg new file mode 100644 index 0000000000..941c68562f Binary files /dev/null and b/mods/ITEMS/REDSTONE/mesecons_noteblock/sounds/mesecons_noteblock_gsharp2.ogg differ