-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathharmonica.lua
32 lines (29 loc) · 1.01 KB
/
harmonica.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
local notes = {"harmonica_0", "harmonica_1", "harmonica_2", "harmonica_3", "harmonica_4", "harmonica_3", "harmonica_1", "harmonica_2"}
local current_note = 0
local current_sound = 0
minetest.register_tool("instruments_mcl:harmonica", {
description = "Harmonica",
range = 0.35,
inventory_image = "harmonica.png",
wield_image = "harmonica.png",
on_secondary_use = function()
minetest.sound_fade(current_sound, 0,5, 0)
current_note = current_note + 1
if current_note > table.getn(notes) then
current_note = 1
end
--minetest.log(current_note)
--minetest.log(notes[current_note])
current_sound = minetest.sound_play(notes[current_note], {gain = 1})
end
})
minetest.register_craftitem("instruments_mcl:harmonica_casing", {
description = "Harmonica Casing",
inventory_image = "harmonica_casing.png",
wield_image = "harmonica_casing.png"
})
minetest.register_craftitem("instruments_mcl:harmonica_body", {
description = "Harmonica Body",
inventory_image = "harmonica_body.png",
wield_image = "harmonica_body.png"
})