1
0
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:
tenplus1
2026-01-09 10:47:21 +00:00
parent 85ed66ca09
commit 6cff2a6d94
3 changed files with 23 additions and 0 deletions

10
api.txt
View File

@@ -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
-----------------

View File

@@ -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)

View File

@@ -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