play_sound
¶
implements tools for quickly playing audio.
Guns4d.play_sounds() | allows you to play one or more sounds with more complex features, so sounds can be easily coded for guns without the need for functions |
Guns4d.get_sounds() | gets a list of currently playing Minetest sound handles from the Guns4d sound handle |
Guns4d.stop_sounds() | stops a list of sounds |
allows you to play one or more sounds with more complex features, so sounds can be easily coded for guns without the need for functions.
WARNING: this function modifies the tables passed to it, use Guns4d.table.shallow_copy()
or table.copy
for inputted soundspecs
{
to_player = "singeplayer",
min_distance = 100, --soundspec_to_play1 & soundspec_to_play2 will share this field as it is in the higher level table (as well as the above field)
soundspec_to_play1, --a sound parameter table
soundspec_to_play2
}
soundspecs_list | (table) | a list a list of soundspecs optionally accompanied with fields to be used in all of them. |
(integer) | guns4d sound handle, used by stop_sounds & get_sounds |
gets a list of currently playing Minetest sound handles from the Guns4d sound handle. Modification of table highly discouraged.
handle | (integer) | a sound handle as returned by play_sounds |
(table) | a list of sound handles as returned by minetest.sound_play() |
stops a list of sounds
handle | (integer or table) | a guns4d sound handle OR list of minetest sound handles to stop |
(bool) | returns true if successful. |
simple specification for playing a sound in relation to an action, acts as a layer of minetest.play_sound. ATTENTION: read lua_api.md for more parameters! all parameters from there are valid unless otherwise stated here, these are auxillary.
soundspec = {
sounds = { --weighted randoms
fire_fp = .5.
fire_fp_2 = .2.
fire_fp_3 = .3
},
pitch = {
min = .6,
max = 1
},
gain = 1, --format for pitch and gain is interchangable.
min_hear_distance = 20, --this is for distant gunshots, for example. Entirely optional. Cannot be used with to_player
exclude_player
to_player
--when present it automatically plays positionless audio, as this is for first person effects.
}
min_hear_distance¶ |
|
sounds¶ |
|
to_player¶ |
|
player¶ |
|
delay¶ |
|
attenuation_rate¶ |
|
split_audio_by_perspective¶ |
|
third_person_gain_multiplier¶ |
|