Feature: New API and looping sound fix.

master
aa6 2018-01-02 18:08:26 +03:00
parent 6f16870421
commit b7f51351f0
4 changed files with 12 additions and 10 deletions

View File

@ -2,10 +2,6 @@
Mod that adds hard breathing sound below the dyspnea threshold level. Mod that adds hard breathing sound below the dyspnea threshold level.
**Warnings:**
Unfortunately there is a problem right now with sound looping - it won't loop. I will try to find a solution.
**How to install:** **How to install:**
http://wiki.minetest.com/wiki/Installing_mods http://wiki.minetest.com/wiki/Installing_mods

View File

@ -1 +1 @@
0.0.4 0.1.0

View File

@ -1,19 +1,25 @@
local sound_handlers = {} local sound_handlers = {}
minetest_wadsprint.api.events:on("dyspnea",function(event) minetest_wadsprint.api.events:on("dyspnea-on",
if event.value == true then function(event)
sound_handlers[event.player.name] = minetest.sound_play( sound_handlers[event.player.name] = minetest.sound_play(
{ {
loop = true,
name = "minetest_wadsprint_dyspnea_hardbreath", name = "minetest_wadsprint_dyspnea_hardbreath",
}, },
{ {
loop = true,
object = event.player.obj, object = event.player.obj,
} }
) )
else end
)
minetest_wadsprint.api.events:on("dyspnea-off",
function(event)
if sound_handlers[event.player.name] ~= nil then if sound_handlers[event.player.name] ~= nil then
minetest.sound_stop(sound_handlers[event.player.name]) minetest.sound_stop(sound_handlers[event.player.name])
end end
end end
end) )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB