mirror of
https://codeberg.org/tenplus1/ambience.git
synced 2026-01-12 11:45:25 +01:00
add ambience.add_to_set function
This commit is contained in:
10
api.txt
10
api.txt
@@ -59,6 +59,16 @@ Instead of counting each node total for things like leaves within the sound_chec
|
||||
local number = ambience.group_totals(def.totals, "leaves") -- count all group:leaves
|
||||
|
||||
|
||||
Adding sound to existing Set
|
||||
----------------------------
|
||||
|
||||
ambience.add_to_set(set_name, sound_table)
|
||||
|
||||
e.g.
|
||||
|
||||
ambience.add_to_set("underwater", {name = "scuba", pitch = 1.2, length = 8})
|
||||
|
||||
|
||||
Getting Sound Set
|
||||
-----------------
|
||||
|
||||
|
||||
9
init.lua
9
init.lua
@@ -59,6 +59,15 @@ function ambience.add_set(set_name, def)
|
||||
end
|
||||
end
|
||||
|
||||
-- add sound to existing set
|
||||
|
||||
function ambience.add_to_set(set_name, def)
|
||||
|
||||
if not set_name or not def or not sound_sets[set_name] then return end
|
||||
|
||||
table.insert(sound_sets[set_name].sounds, def)
|
||||
end
|
||||
|
||||
-- return set from list using name
|
||||
|
||||
function ambience.get_set(set_name)
|
||||
|
||||
@@ -76,6 +76,10 @@ ambience.add_set("underwater", {
|
||||
end
|
||||
})
|
||||
|
||||
-- add new sound to above set
|
||||
|
||||
ambience.add_to_set("underwater", {name = "scuba", pitch = 1.2, length = 8})
|
||||
|
||||
-- Splashing sound plays when player walks inside water nodes (if enabled)
|
||||
|
||||
if core.settings:get_bool("ambience_water_move") ~= false then
|
||||
|
||||
Reference in New Issue
Block a user