summaryrefslogtreecommitdiff
path: root/doc/lua_api.txt
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2020-01-25 21:19:29 +0100
committersfan5 <sfan5@live.de>2020-02-01 20:31:41 +0100
commitace3c76112a839aaad34f4343cd924412310bbd3 (patch)
tree6efeeb3537314a3cf8594f1a8f80eb28523ccad9 /doc/lua_api.txt
parentea5e231959365622607c8bfd953f6d96ec54a394 (diff)
downloadminetest-ace3c76112a839aaad34f4343cd924412310bbd3.tar.gz
minetest-ace3c76112a839aaad34f4343cd924412310bbd3.tar.bz2
minetest-ace3c76112a839aaad34f4343cd924412310bbd3.zip
Improve core.sound_play with ephemeral sounds and player exclusion
Diffstat (limited to 'doc/lua_api.txt')
-rw-r--r--doc/lua_api.txt20
1 files changed, 17 insertions, 3 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 6b8dcb5fc..051ca97cf 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -826,7 +826,7 @@ Examples of sound parameter tables:
gain = 1.0, -- default
loop = true,
}
- -- Play in a location
+ -- Play at a location
{
pos = {x = 1, y = 2, z = 3},
gain = 1.0, -- default
@@ -839,13 +839,22 @@ Examples of sound parameter tables:
max_hear_distance = 32, -- default, uses an euclidean metric
loop = true,
}
+ -- Play at a location, heard by anyone *but* the given player
+ {
+ pos = {x = 32, y = 0, z = 100},
+ max_hear_distance = 40,
+ exclude_player = name,
+ }
Looped sounds must either be connected to an object or played locationless to
-one player using `to_player = name,`.
+one player using `to_player = name`.
A positional sound will only be heard by players that are within
`max_hear_distance` of the sound position, at the start of the sound.
+`exclude_player = name` can be applied to locationless, positional and object-
+bound sounds to exclude a single player from hearing them.
+
`SimpleSoundSpec`
-----------------
@@ -4929,10 +4938,15 @@ Defaults for the `on_punch` and `on_dig` node definition callbacks
Sounds
------
-* `minetest.sound_play(spec, parameters)`: returns a handle
+* `minetest.sound_play(spec, parameters, [ephemeral])`: returns a handle
* `spec` is a `SimpleSoundSpec`
* `parameters` is a sound parameter table
+ * `ephemeral` is a boolean (default: false)
+ Ephemeral sounds will not return a handle and can't be stopped or faded.
+ It is recommend to use this for short sounds that happen in response to
+ player actions (e.g. door closing).
* `minetest.sound_stop(handle)`
+ * `handle` is a handle returned by `minetest.sound_play`
* `minetest.sound_fade(handle, step, gain)`
* `handle` is a handle returned by `minetest.sound_play`
* `step` determines how fast a sound will fade.