diff options
20 files changed, 77 insertions, 0 deletions
diff --git a/mesecons_noteblock/depends.txt b/mesecons_noteblock/depends.txt new file mode 100644 index 0000000..acaa924 --- /dev/null +++ b/mesecons_noteblock/depends.txt @@ -0,0 +1 @@ +mesecons diff --git a/mesecons_noteblock/init.lua b/mesecons_noteblock/init.lua new file mode 100644 index 0000000..c1f75f0 --- /dev/null +++ b/mesecons_noteblock/init.lua @@ -0,0 +1,76 @@ +minetest.register_node("mesecons_noteblock:noteblock", { + description = "Noteblock", + tile_images = {"mesecons_noteblock.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + drawtype = "allfaces_optional", + visual_scale = 1.3, + paramtype="light", +}) + +minetest.register_on_placenode(function (pos, node) + if node.name=="mesecons_noteblock:noteblock" then + minetest.env:add_node(pos, {name=node.name, param2=0}) + end +end) + +minetest.register_on_punchnode(function (pos, node) + if node.name=="mesecons_noteblock:noteblock" then + local param2 = node.param2+1 + if param2==12 then param2=0 end + minetest.env:add_node(pos, {name=node.name, param2=param2}) + mesecon.noteblock_play(pos, node) + end +end) + +mesecon.noteblock_play = function (pos, node) + local soundname + if node.param2==8 then + soundname="mesecons_noteblock_a" + elseif node.param2==9 then + soundname="mesecons_noteblock_asharp" + elseif node.param2==10 then + soundname="mesecons_noteblock_b" + elseif node.param2==11 then + soundname="mesecons_noteblock_c" + elseif node.param2==0 then + soundname="mesecons_noteblock_csharp" + elseif node.param2==1 then + soundname="mesecons_noteblock_d" + elseif node.param2==2 then + soundname="mesecons_noteblock_dsharp" + elseif node.param2==3 then + soundname="mesecons_noteblock_e" + elseif node.param2==4 then + soundname="mesecons_noteblock_f" + elseif node.param2==5 then + soundname="mesecons_noteblock_fsharp" + elseif node.param2==6 then + soundname="mesecons_noteblock_g" + elseif node.param2==7 then + soundname="mesecons_noteblock_gsharp" + end + local block_below_name = minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z}).name + if block_below_name == "default:glass" then + soundname="mesecons_noteblock_hihat" + end + if block_below_name == "default:stone" then + soundname="mesecons_noteblock_kick" + end + if block_below_name == "default:chest" then + soundname="mesecons_noteblock_snare" + end + if block_below_name == "default:tree" then + soundname="mesecons_noteblock_crash" + end + if block_below_name == "default:wood" then + soundname="mesecons_noteblock_litecrash" + end + minetest.sound_play(soundname, + {pos = pos, gain = 1.0, max_hear_distance = 32,}) +end + +mesecon:register_on_signal_on(function(pos, node) + if node.name=="mesecons_noteblock:noteblock" then + mesecon.noteblock_play(pos, node) + end +end) diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_a.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_a.ogg Binary files differnew file mode 100644 index 0000000..5668a8a --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_a.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_asharp.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_asharp.ogg Binary files differnew file mode 100644 index 0000000..4cd2dcc --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_asharp.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_b.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_b.ogg Binary files differnew file mode 100644 index 0000000..621a6b5 --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_b.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_c.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_c.ogg Binary files differnew file mode 100644 index 0000000..e235978 --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_c.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_crash.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_crash.ogg Binary files differnew file mode 100644 index 0000000..d33027a --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_crash.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_csharp.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_csharp.ogg Binary files differnew file mode 100644 index 0000000..50ba835 --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_csharp.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_d.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_d.ogg Binary files differnew file mode 100644 index 0000000..f1227ba --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_d.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_dsharp.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_dsharp.ogg Binary files differnew file mode 100644 index 0000000..817728e --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_dsharp.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_e.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_e.ogg Binary files differnew file mode 100644 index 0000000..c91d1a6 --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_e.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_f.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_f.ogg Binary files differnew file mode 100644 index 0000000..3f1eaea --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_f.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_fsharp.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_fsharp.ogg Binary files differnew file mode 100644 index 0000000..9f13797 --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_fsharp.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_g.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_g.ogg Binary files differnew file mode 100644 index 0000000..d2a90dd --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_g.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_gsharp.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_gsharp.ogg Binary files differnew file mode 100644 index 0000000..6177b8c --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_gsharp.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_hihat.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_hihat.ogg Binary files differnew file mode 100644 index 0000000..d05a870 --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_hihat.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_kick.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_kick.ogg Binary files differnew file mode 100644 index 0000000..108e89e --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_kick.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg Binary files differnew file mode 100644 index 0000000..21aecfa --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_snare.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_snare.ogg Binary files differnew file mode 100644 index 0000000..25d7b78 --- /dev/null +++ b/mesecons_noteblock/sounds/mesecons_noteblock_snare.ogg diff --git a/mesecons_noteblock/textures/mesecons_noteblock.png b/mesecons_noteblock/textures/mesecons_noteblock.png Binary files differnew file mode 100644 index 0000000..31e7f2f --- /dev/null +++ b/mesecons_noteblock/textures/mesecons_noteblock.png |