Merge pull request 'Give an option for players to disable the in game music' (#3299) from music_settings_switch into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3299
Reviewed-by: 𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 <mrrar@noreply.git.minetest.land>
This commit is contained in:
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 2023-01-13 21:31:20 +00:00
commit dd15092052
2 changed files with 19 additions and 10 deletions

View file

@ -1,6 +1,8 @@
local modname = minetest.get_current_modname() local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)
local music_enabled = minetest.settings:get_bool("mcl_game_music", true)
local pianowtune = "diminixed-pianowtune01" local pianowtune = "diminixed-pianowtune01"
local end_tune = "diminixed-ambientwip" local end_tune = "diminixed-ambientwip"
local nether_tune = "horizonchris96-traitor" local nether_tune = "horizonchris96-traitor"
@ -99,15 +101,19 @@ local function play()
minetest.after(7, play) minetest.after(7, play)
end end
minetest.after(15, play) if music_enabled then
minetest.log("action", "[mcl_music] In game music is activated")
minetest.after(15, play)
minetest.register_on_joinplayer(function(player, last_login) minetest.register_on_joinplayer(function(player, last_login)
local player_name = player:get_player_name() local player_name = player:get_player_name()
stop_music_for_listener_name(player_name) stop_music_for_listener_name(player_name)
end) end)
minetest.register_on_respawnplayer(function(player)
local player_name = player:get_player_name()
stop_music_for_listener_name(player_name)
end)
minetest.register_on_respawnplayer(function(player)
local player_name = player:get_player_name()
stop_music_for_listener_name(player_name)
end)
else
minetest.log("action", "[mcl_music] In game music is deactivated")
end

View file

@ -139,6 +139,9 @@ mcl_mob_active_range (Active mob range) int 48 0 256
# Enable flame sound. # Enable flame sound.
flame_sound (Flame sound) bool true flame_sound (Flame sound) bool true
# Enable the in game music.
mcl_game_music (Enable in game music) bool true
[Graphics] [Graphics]
# How many vertical animation frames the fire texture (fire_basic_flame_animated.png) has. # How many vertical animation frames the fire texture (fire_basic_flame_animated.png) has.
# This may vary depending on the texture pack you use. # This may vary depending on the texture pack you use.