diff --git a/mesecons_noteblock/doc/noteblock/description.html b/mesecons_noteblock/doc/noteblock/description.html index c2cfaf0..e11724d 100644 --- a/mesecons_noteblock/doc/noteblock/description.html +++ b/mesecons_noteblock/doc/noteblock/description.html @@ -1,12 +1,13 @@ -This effector makes a sound if powered and can be used for making music. Normally it makes piano sounds. The sound frequency can be changed by punching the block. There are some special sounds that depend on the block below: +This effector makes a sound if powered and can be used for making music. Normally it makes piano sounds. The sound frequency can be changed by punching the block (only works for piano). There are some special sounds that depend on the block below: - - - - - - - - + + + + + + + + +
Block BelowEffect
GlassHihat
StoneKick
ChestSnare
TreeCrash
WoodLite Crash
Coal BlockExplosion Sound
Lava SourceFire Sound
Steel BlockRaises the pitch by one octave
Glass or Obsidian GlassHi-hat
Any stoneKick
Chest or Locked ChestSnare
Any treeCrash
Any wooden planksLite Crash
Coal BlockExplosion sound
Lava SourceFire sound
Steel BlockPiano (high pitch, one octave higher than normal)
Any other blockPiano (low pitch)
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,19 +43,33 @@ 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) pos.y = pos.y-1 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