From 312f95b659c3308866049f781e73664c0b850af6 Mon Sep 17 00:00:00 2001 From: Jeija Date: Fri, 6 Apr 2012 20:05:36 +0200 Subject: Add Noteblock --- mesecons_noteblock/depends.txt | 1 + mesecons_noteblock/init.lua | 76 +++++++++++++++++++++ mesecons_noteblock/sounds/mesecons_noteblock_a.ogg | Bin 0 -> 7436 bytes .../sounds/mesecons_noteblock_asharp.ogg | Bin 0 -> 7436 bytes mesecons_noteblock/sounds/mesecons_noteblock_b.ogg | Bin 0 -> 7068 bytes mesecons_noteblock/sounds/mesecons_noteblock_c.ogg | Bin 0 -> 8309 bytes .../sounds/mesecons_noteblock_crash.ogg | Bin 0 -> 30548 bytes .../sounds/mesecons_noteblock_csharp.ogg | Bin 0 -> 8271 bytes mesecons_noteblock/sounds/mesecons_noteblock_d.ogg | Bin 0 -> 8101 bytes .../sounds/mesecons_noteblock_dsharp.ogg | Bin 0 -> 7860 bytes mesecons_noteblock/sounds/mesecons_noteblock_e.ogg | Bin 0 -> 7725 bytes mesecons_noteblock/sounds/mesecons_noteblock_f.ogg | Bin 0 -> 7907 bytes .../sounds/mesecons_noteblock_fsharp.ogg | Bin 0 -> 7573 bytes mesecons_noteblock/sounds/mesecons_noteblock_g.ogg | Bin 0 -> 7388 bytes .../sounds/mesecons_noteblock_gsharp.ogg | Bin 0 -> 7347 bytes .../sounds/mesecons_noteblock_hihat.ogg | Bin 0 -> 4863 bytes .../sounds/mesecons_noteblock_kick.ogg | Bin 0 -> 7363 bytes .../sounds/mesecons_noteblock_litecrash.ogg | Bin 0 -> 18283 bytes .../sounds/mesecons_noteblock_snare.ogg | Bin 0 -> 7097 bytes mesecons_noteblock/textures/mesecons_noteblock.png | Bin 0 -> 808 bytes 20 files changed, 77 insertions(+) create mode 100644 mesecons_noteblock/depends.txt create mode 100644 mesecons_noteblock/init.lua create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_a.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_asharp.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_b.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_c.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_crash.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_csharp.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_d.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_dsharp.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_e.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_f.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_fsharp.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_g.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_gsharp.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_hihat.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_kick.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg create mode 100644 mesecons_noteblock/sounds/mesecons_noteblock_snare.ogg create mode 100644 mesecons_noteblock/textures/mesecons_noteblock.png 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 new file mode 100644 index 0000000..5668a8a Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_a.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_asharp.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_asharp.ogg new file mode 100644 index 0000000..4cd2dcc Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_asharp.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_b.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_b.ogg new file mode 100644 index 0000000..621a6b5 Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_b.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_c.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_c.ogg new file mode 100644 index 0000000..e235978 Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_c.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_crash.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_crash.ogg new file mode 100644 index 0000000..d33027a Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_crash.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_csharp.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_csharp.ogg new file mode 100644 index 0000000..50ba835 Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_csharp.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_d.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_d.ogg new file mode 100644 index 0000000..f1227ba Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_d.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_dsharp.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_dsharp.ogg new file mode 100644 index 0000000..817728e Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_dsharp.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_e.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_e.ogg new file mode 100644 index 0000000..c91d1a6 Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_e.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_f.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_f.ogg new file mode 100644 index 0000000..3f1eaea Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_f.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_fsharp.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_fsharp.ogg new file mode 100644 index 0000000..9f13797 Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_fsharp.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_g.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_g.ogg new file mode 100644 index 0000000..d2a90dd Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_g.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_gsharp.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_gsharp.ogg new file mode 100644 index 0000000..6177b8c Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_gsharp.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_hihat.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_hihat.ogg new file mode 100644 index 0000000..d05a870 Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_hihat.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_kick.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_kick.ogg new file mode 100644 index 0000000..108e89e Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_kick.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg new file mode 100644 index 0000000..21aecfa Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg differ diff --git a/mesecons_noteblock/sounds/mesecons_noteblock_snare.ogg b/mesecons_noteblock/sounds/mesecons_noteblock_snare.ogg new file mode 100644 index 0000000..25d7b78 Binary files /dev/null and b/mesecons_noteblock/sounds/mesecons_noteblock_snare.ogg differ diff --git a/mesecons_noteblock/textures/mesecons_noteblock.png b/mesecons_noteblock/textures/mesecons_noteblock.png new file mode 100644 index 0000000..31e7f2f Binary files /dev/null and b/mesecons_noteblock/textures/mesecons_noteblock.png differ -- cgit v1.2.3