mirror of
https://codeberg.org/tenplus1/ambience.git
synced 2024-12-28 03:30:28 +01:00
tweak for 5.0
This commit is contained in:
parent
e8db802d86
commit
66e73ddf31
18
init.lua
18
init.lua
@ -11,7 +11,6 @@ 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")
|
|
||||||
|
|
||||||
|
|
||||||
-- add set to list
|
-- add set to list
|
||||||
@ -100,17 +99,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
|
||||||
@ -326,15 +318,10 @@ 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
|
||||||
|
|
||||||
@ -365,15 +352,10 @@ 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
|
||||||
|
|
||||||
|
3
mod.conf
3
mod.conf
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user