forked from Mineclonia/Mineclonia
Change note block special sound materials
This commit is contained in:
parent
549f541877
commit
1b97d4d361
|
@ -1,5 +1,7 @@
|
||||||
minetest.register_node("mesecons_noteblock:noteblock", {
|
minetest.register_node("mesecons_noteblock:noteblock", {
|
||||||
description = "Note Block",
|
description = "Note Block",
|
||||||
|
_doc_items_longdesc = "A note block is a redstone component which plays a musical note when it is supplied with redstone power.",
|
||||||
|
_doc_items_usagehelp = "Rightclick the note block to choose one of many possible notes to play.",
|
||||||
tiles = {"mesecons_noteblock.png"},
|
tiles = {"mesecons_noteblock.png"},
|
||||||
groups = {handy=1,axey=1, material_wood=1},
|
groups = {handy=1,axey=1, material_wood=1},
|
||||||
drawtype = "allfaces_optional",
|
drawtype = "allfaces_optional",
|
||||||
|
@ -42,6 +44,7 @@ minetest.register_craft({
|
||||||
|
|
||||||
mesecon.noteblock_play = function (pos, param2)
|
mesecon.noteblock_play = function (pos, param2)
|
||||||
local soundname
|
local soundname
|
||||||
|
-- TODO: 24 piano notes
|
||||||
if param2==8 then
|
if param2==8 then
|
||||||
soundname="mesecons_noteblock_a"
|
soundname="mesecons_noteblock_a"
|
||||||
elseif param2==9 then
|
elseif param2==9 then
|
||||||
|
@ -68,20 +71,18 @@ mesecon.noteblock_play = function (pos, param2)
|
||||||
soundname="mesecons_noteblock_gsharp"
|
soundname="mesecons_noteblock_gsharp"
|
||||||
end
|
end
|
||||||
local block_below_name = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
local block_below_name = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||||
if block_below_name == "mcl_core:glass" then
|
if minetest.get_item_group(block_below_name, "material_glass") ~= 0 then
|
||||||
soundname="mesecons_noteblock_hihat"
|
-- TODO: Sticks and clicks
|
||||||
end
|
|
||||||
if block_below_name == "mcl_core:stone" then
|
|
||||||
soundname="mesecons_noteblock_kick"
|
soundname="mesecons_noteblock_kick"
|
||||||
end
|
elseif minetest.get_item_group(block_below_name, "material_wood") ~= 0 then
|
||||||
if block_below_name == "mcl_core:chest" then
|
-- TODO: Bass guitar
|
||||||
soundname="mesecons_noteblock_snare"
|
|
||||||
end
|
|
||||||
if block_below_name == "mcl_core:tree" then
|
|
||||||
soundname="mesecons_noteblock_crash"
|
soundname="mesecons_noteblock_crash"
|
||||||
end
|
elseif minetest.get_item_group(block_below_name, "material_sand") ~= 0 then
|
||||||
if block_below_name == "mcl_core:wood" then
|
-- TODO: 24 Snare drum sounds
|
||||||
soundname="mesecons_noteblock_litecrash"
|
soundname="mesecons_noteblock_snare"
|
||||||
|
elseif minetest.get_item_group(block_below_name, "material_stone") ~= 0 then
|
||||||
|
-- TODO: Bass drum
|
||||||
|
soundname="mesecons_noteblock_snare"
|
||||||
end
|
end
|
||||||
minetest.sound_play(soundname,
|
minetest.sound_play(soundname,
|
||||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||||
|
|
Loading…
Reference in New Issue