diff options
author | Wuzzy <wuzzy2@mail.ru> | 2020-08-08 11:22:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-08 12:22:51 +0300 |
commit | 16836b16d690e2d337575afe9fde286f32ec5d5f (patch) | |
tree | 4d835cec6201dca3d70cc80e8886acba3fcd2700 /mesecons_noteblock/init.lua | |
parent | c1eccba24760e0b80666dd8d1e56b5fe7f3a5b28 (diff) | |
download | mesecons-16836b16d690e2d337575afe9fde286f32ec5d5f.tar mesecons-16836b16d690e2d337575afe9fde286f32ec5d5f.tar.gz mesecons-16836b16d690e2d337575afe9fde286f32ec5d5f.tar.bz2 mesecons-16836b16d690e2d337575afe9fde286f32ec5d5f.tar.xz mesecons-16836b16d690e2d337575afe9fde286f32ec5d5f.zip |
Make more nodes trigger special noteblock sounds (#506)
Diffstat (limited to 'mesecons_noteblock/init.lua')
-rw-r--r-- | mesecons_noteblock/init.lua | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/mesecons_noteblock/init.lua b/mesecons_noteblock/init.lua index 55a9bd7..b4e7d24 100644 --- a/mesecons_noteblock/init.lua +++ b/mesecons_noteblock/init.lua @@ -43,13 +43,18 @@ local soundnames = { } local node_sounds = { - ["default:glass"] = "mesecons_noteblock_hihat", - ["default:stone"] = "mesecons_noteblock_kick", ["default:lava_source"] = "fire_fire", ["default:chest"] = "mesecons_noteblock_snare", - ["default:tree"] = "mesecons_noteblock_crash", - ["default:wood"] = "mesecons_noteblock_litecrash", + ["default:chest_locked"] = "mesecons_noteblock_snare", ["default:coalblock"] = "tnt_explode", + ["default:glass"] = "mesecons_noteblock_hihat", + ["default:obsidian_glass"] = "mesecons_noteblock_hihat", +} + +local node_sounds_group = { + ["stone"] = "mesecons_noteblock_kick", + ["tree"] = "mesecons_noteblock_crash", + ["wood"] = "mesecons_noteblock_litecrash", } mesecon.noteblock_play = function(pos, param2) @@ -57,6 +62,15 @@ mesecon.noteblock_play = function(pos, param2) local nodeunder = minetest.get_node(pos).name local soundname = node_sounds[nodeunder] if not soundname then + for k,v in pairs(node_sounds_group) do + local g = minetest.get_item_group(nodeunder, k) + if g ~= 0 then + soundname = v + break + end + end + end + if not soundname then soundname = soundnames[param2] if not soundname then minetest.log("error", "[mesecons_noteblock] No soundname found, test param2") |