Added support for sounds that are played when a list stops
parent
78e229a265
commit
0bc690c5a6
28
init.lua
28
init.lua
|
@ -53,6 +53,7 @@ local water = {
|
||||||
local water_frequent = {
|
local water_frequent = {
|
||||||
handler = {},
|
handler = {},
|
||||||
frequency = 100,
|
frequency = 100,
|
||||||
|
on_stop = "drowning_gasp",
|
||||||
{name="scuba1bubbles", length=11},
|
{name="scuba1bubbles", length=11},
|
||||||
{name="scuba1calm", length=10},
|
{name="scuba1calm", length=10},
|
||||||
{name="scuba1calm2", length=8.5},
|
{name="scuba1calm2", length=8.5},
|
||||||
|
@ -133,6 +134,9 @@ local stop_sound = function(still_playing, player)
|
||||||
if still_playing.cave == nil then
|
if still_playing.cave == nil then
|
||||||
local list = cave
|
local list = cave
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
|
if list.on_stop ~= nil then
|
||||||
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
||||||
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
end
|
end
|
||||||
|
@ -140,6 +144,9 @@ local stop_sound = function(still_playing, player)
|
||||||
if still_playing.cave_frequent == nil then
|
if still_playing.cave_frequent == nil then
|
||||||
local list = cave_frequent
|
local list = cave_frequent
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
|
if list.on_stop ~= nil then
|
||||||
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
||||||
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
end
|
end
|
||||||
|
@ -147,6 +154,9 @@ local stop_sound = function(still_playing, player)
|
||||||
if still_playing.night == nil then
|
if still_playing.night == nil then
|
||||||
local list = night
|
local list = night
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
|
if list.on_stop ~= nil then
|
||||||
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
||||||
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
end
|
end
|
||||||
|
@ -154,6 +164,9 @@ local stop_sound = function(still_playing, player)
|
||||||
if still_playing.night_frequent == nil then
|
if still_playing.night_frequent == nil then
|
||||||
local list = night_frequent
|
local list = night_frequent
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
|
if list.on_stop ~= nil then
|
||||||
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
||||||
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
end
|
end
|
||||||
|
@ -161,6 +174,9 @@ local stop_sound = function(still_playing, player)
|
||||||
if still_playing.day == nil then
|
if still_playing.day == nil then
|
||||||
local list = day
|
local list = day
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
|
if list.on_stop ~= nil then
|
||||||
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
||||||
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
end
|
end
|
||||||
|
@ -168,6 +184,9 @@ local stop_sound = function(still_playing, player)
|
||||||
if still_playing.day_frequent == nil then
|
if still_playing.day_frequent == nil then
|
||||||
local list = day_frequent
|
local list = day_frequent
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
|
if list.on_stop ~= nil then
|
||||||
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
||||||
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
end
|
end
|
||||||
|
@ -175,6 +194,9 @@ local stop_sound = function(still_playing, player)
|
||||||
if still_playing.music == nil then
|
if still_playing.music == nil then
|
||||||
local list = music
|
local list = music
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
|
if list.on_stop ~= nil then
|
||||||
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
||||||
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
end
|
end
|
||||||
|
@ -182,6 +204,9 @@ local stop_sound = function(still_playing, player)
|
||||||
if still_playing.water == nil then
|
if still_playing.water == nil then
|
||||||
local list = water
|
local list = water
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
|
if list.on_stop ~= nil then
|
||||||
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
||||||
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
end
|
end
|
||||||
|
@ -189,6 +214,9 @@ local stop_sound = function(still_playing, player)
|
||||||
if still_playing.water_frequent == nil then
|
if still_playing.water_frequent == nil then
|
||||||
local list = water_frequent
|
local list = water_frequent
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
|
if list.on_stop ~= nil then
|
||||||
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
||||||
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
end
|
end
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue