1
0
mirror of https://codeberg.org/tenplus1/ambience.git synced 2025-07-19 08:50:20 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
0e444c726c esperanto translation added (thx JadedCtrl) 2023-10-16 07:59:12 +01:00
66e73ddf31 tweak for 5.0 2023-09-08 20:33:02 +01:00
e8db802d86 5.x 2023-08-08 18:25:48 +01:00
6 changed files with 33 additions and 38 deletions

View File

@ -1,3 +0,0 @@
default
fire?
playerplus?

View File

@ -1 +0,0 @@
Adds realistic sound effects into your world.

View File

@ -11,8 +11,9 @@ local playing = {}
local sound_sets = {} -- all the sounds and their settings local sound_sets = {} -- all the sounds and their settings
local sound_set_order = {} -- needed because pairs loops randomly through tables local sound_set_order = {} -- needed because pairs loops randomly through tables
local set_nodes = {} -- all the nodes needed for sets local set_nodes = {} -- all the nodes needed for sets
local is_50 = minetest.has_feature("object_use_texture_alpha")
-- translation
local S = minetest.get_translator("ambience")
-- add set to list -- add set to list
ambience.add_set = function(set_name, def) ambience.add_set = function(set_name, def)
@ -100,17 +101,10 @@ minetest.register_on_joinplayer(function(player)
playing[name] = {music = -1} playing[name] = {music = -1}
local mvol, svol local mvol, svol
if is_50 then
local meta = player:get_meta() local meta = player:get_meta()
mvol = meta:get_string("ambience.mvol") mvol = meta:get_string("ambience.mvol")
svol = meta:get_string("ambience.svol") svol = meta:get_string("ambience.svol")
else
mvol = player:get_attribute("ambience.mvol")
svol = player:get_attribute("ambience.svol")
end
mvol = tonumber(mvol) or MUSICVOLUME mvol = tonumber(mvol) or MUSICVOLUME
svol = tonumber(svol) or SOUNDVOLUME svol = tonumber(svol) or SOUNDVOLUME
@ -315,8 +309,8 @@ end)
-- sound volume command -- sound volume command
minetest.register_chatcommand("svol", { minetest.register_chatcommand("svol", {
params = "<svol>", params = S("<svol>"),
description = "set sound volume (0.1 to 1.0)", description = S("set sound volume (0.1 to 1.0)"),
privs = {}, privs = {},
func = function(name, param) func = function(name, param)
@ -326,27 +320,22 @@ minetest.register_chatcommand("svol", {
if svol < 0.1 then svol = 0.1 end if svol < 0.1 then svol = 0.1 end
if svol > 1.0 then svol = 1.0 end if svol > 1.0 then svol = 1.0 end
if is_50 then
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)
local meta = player:get_meta() local meta = player:get_meta()
meta:set_string("ambience.svol", svol) meta:set_string("ambience.svol", svol)
else
player:set_attribute("ambience.svol", svol)
end
playing[name].svol = svol playing[name].svol = svol
return true, "Sound volume set to " .. svol return true, S("Sound volume set to @1", svol)
end end
}) })
-- music volume command (0 stops music) -- music volume command (0 stops music)
minetest.register_chatcommand("mvol", { minetest.register_chatcommand("mvol", {
params = "<mvol>", params = S("<mvol>"),
description = "set music volume (0.1 to 1.0, 0 to stop music)", description = S("set music volume (0.1 to 1.0, 0 to stop music)"),
privs = {}, privs = {},
func = function(name, param) func = function(name, param)
@ -365,19 +354,14 @@ minetest.register_chatcommand("mvol", {
if mvol < 0 then mvol = 0 end if mvol < 0 then mvol = 0 end
if mvol > 1.0 then mvol = 1.0 end if mvol > 1.0 then mvol = 1.0 end
if is_50 then
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)
local meta = player:get_meta() local meta = player:get_meta()
meta:set_string("ambience.mvol", mvol) meta:set_string("ambience.mvol", mvol)
else
player:set_attribute("ambience.mvol", mvol)
end
playing[name].mvol = mvol playing[name].mvol = mvol
return true, "Music volume set to " .. mvol return true, S("Music volume set to @1", mvol)
end end
}) })

7
locale/ambience.eo.tr Normal file
View File

@ -0,0 +1,7 @@
# textdomain: ambience
<svol>=<slaŭtec>
set sound volume (0.1 to 1.0)=agordi sonlaŭtecon (0.1 ĝis 1.0)
Sound volume set to @1=Sonlaŭteco agordita al @1
<mvol>=<mlaŭtec>
set music volume (0.1 to 1.0, 0 to stop music)=agordi muziklaŭtecon (0.1 ĝis 1.0; malŝalti muzikon per 0)
Music volume set to @1=Muziklaŭteco agordita al @1

7
locale/template.txt Normal file
View File

@ -0,0 +1,7 @@
# textdomain: ambience
<svol>=
set sound volume (0.1 to 1.0)=
Sound volume set to @1=
<mvol>=
set music volume (0.1 to 1.0, 0 to stop music)=
Music volume set to @1=

View File

@ -1,4 +1,5 @@
name = ambience name = ambience
description = Adds realistic sound effects into your world.
depends = default depends = default
optional_depends = fire, playerplus optional_depends = fire, playerplus
description = Adds realistic sound effects into your world. min_minetest_version = 5.0