summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesecons_noteblock/depends.txt1
-rw-r--r--mesecons_noteblock/init.lua76
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_a.oggbin0 -> 7436 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_asharp.oggbin0 -> 7436 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_b.oggbin0 -> 7068 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_c.oggbin0 -> 8309 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_crash.oggbin0 -> 30548 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_csharp.oggbin0 -> 8271 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_d.oggbin0 -> 8101 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_dsharp.oggbin0 -> 7860 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_e.oggbin0 -> 7725 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_f.oggbin0 -> 7907 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_fsharp.oggbin0 -> 7573 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_g.oggbin0 -> 7388 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_gsharp.oggbin0 -> 7347 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_hihat.oggbin0 -> 4863 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_kick.oggbin0 -> 7363 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_litecrash.oggbin0 -> 18283 bytes
-rw-r--r--mesecons_noteblock/sounds/mesecons_noteblock_snare.oggbin0 -> 7097 bytes
-rw-r--r--mesecons_noteblock/textures/mesecons_noteblock.pngbin0 -> 808 bytes
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
new file mode 100644
index 0000000..5668a8a
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_a.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_asharp.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_b.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_c.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_crash.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_csharp.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_d.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_dsharp.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_e.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_f.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_fsharp.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_g.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_gsharp.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_hihat.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_kick.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_litecrash.ogg
Binary files 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
--- /dev/null
+++ b/mesecons_noteblock/sounds/mesecons_noteblock_snare.ogg
Binary files differ
diff --git a/mesecons_noteblock/textures/mesecons_noteblock.png b/mesecons_noteblock/textures/mesecons_noteblock.png
new file mode 100644
index 0000000..31e7f2f
--- /dev/null
+++ b/mesecons_noteblock/textures/mesecons_noteblock.png
Binary files differ