mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-11 10:30:25 +01:00
added play sound shutdown
improve code shutdown mod added depends.txt added shudown depend soundset
This commit is contained in:
parent
e3cbc98695
commit
96edf51190
1
mods/shutdown/depends.txt
Executable file
1
mods/shutdown/depends.txt
Executable file
@ -0,0 +1 @@
|
||||
soundset?
|
@ -8,6 +8,23 @@ arrête votre serveur "proprement" à une heure précise afin de créer
|
||||
une sauvegarde
|
||||
|
||||
]]--
|
||||
-- compatibility with soundset mod
|
||||
local SOUNDVOLUME = 1
|
||||
local get_volume
|
||||
if (minetest.get_modpath("soundset")) ~= nil then
|
||||
get_volume = soundset.get_gain
|
||||
else
|
||||
get_volume = function (player_name, sound_type) return SOUNDVOLUME end
|
||||
end
|
||||
|
||||
local function sound_play_all(sound)
|
||||
for _, p in ipairs(minetest.get_connected_players()) do
|
||||
local player_name = p:get_player_name()
|
||||
if player_name then
|
||||
minetest.sound_play(sound, {to_player=player_name, gain=get_volume(player_name, "other")})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local timer = 0
|
||||
|
||||
@ -22,19 +39,24 @@ minetest.register_globalstep(function(dtime)
|
||||
local heure = os.date("%H")
|
||||
local minute = os.date("%M")
|
||||
-- Warn every days
|
||||
if heure == "4" and minute == "00" then
|
||||
minetest.chat_send_all("Rappel : Redémarrage journalier du serveur dans 30 minutes. (Dure 30 minutes)")
|
||||
minetest.chat_send_all("Reminder : Daily reboot of the server in 30 minutes. (Lasts 30 minutes)")
|
||||
elseif heure == "4" and minute == "15" then
|
||||
minetest.chat_send_all("Rappel : Redémarrage journalier du serveur dans 15 minutes. (Dure 30 minutes)")
|
||||
minetest.chat_send_all("Reminder : Daily reboot of the server in 15 minutes. (Lasts 30 minutes)")
|
||||
elseif heure == "4" and minute == "25" then
|
||||
minetest.chat_send_all("Rappel : Redémarrage journalier du serveur dans 5 minutes - Pensez à vous deconnecter !")
|
||||
minetest.chat_send_all("Reminder : Daily reboot of the server in 5 minutes - Think about logout!")
|
||||
elseif heure == "4" and minute == "29" then
|
||||
minetest.chat_send_all("=== ARRET DU SERVEUR - DE NOUVEAU EN LIGNE DANS 30 MIN ===")
|
||||
minetest.chat_send_all("=== SERVER SHUTTING DOWN - ONLINE AGAIN IN 30 MIN ===")
|
||||
-- minetest.request_shutdown()
|
||||
if heure == "4" then
|
||||
if minute == "00" then
|
||||
minetest.chat_send_all("Rappel : Redémarrage journalier du serveur dans 30 minutes. (Dure 30 minutes)")
|
||||
minetest.chat_send_all("Reminder : Daily reboot of the server in 30 minutes. (Lasts 30 minutes)")
|
||||
sound_play_all("shutdown_shutdown")
|
||||
elseif minute == "15" then
|
||||
minetest.chat_send_all("Rappel : Redémarrage journalier du serveur dans 15 minutes. (Dure 30 minutes)")
|
||||
minetest.chat_send_all("Reminder : Daily reboot of the server in 15 minutes. (Lasts 30 minutes)")
|
||||
sound_play_all("shutdown_shutdown")
|
||||
elseif minute == "25" then
|
||||
minetest.chat_send_all("Rappel : Redémarrage journalier du serveur dans 5 minutes - Pensez à vous deconnecter !")
|
||||
minetest.chat_send_all("Reminder : Daily reboot of the server in 5 minutes - Think about logout!")
|
||||
sound_play_all("shutdown_shutdown")
|
||||
elseif minute == "29" then
|
||||
minetest.chat_send_all("=== ARRET DU SERVEUR - DE NOUVEAU EN LIGNE DANS 30 MIN ===")
|
||||
minetest.chat_send_all("=== SERVER SHUTTING DOWN - ONLINE AGAIN IN 30 MIN ===")
|
||||
sound_play_all("shutdown_shutdown")
|
||||
-- minetest.request_shutdown()
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
||||
|
Binary file not shown.
BIN
mods/shutdown/sounds/shutdown_shutdown.ogg
Executable file
BIN
mods/shutdown/sounds/shutdown_shutdown.ogg
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user