Script play_sound
implements tools for quickly playing audio.
Functions
Guns4d.play_sounds (sound_specs) | 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.stop_sounds (handle_list) | stops a list of sounds |
Tables
guns4d_soundspec | defines a sound. |
Functions
- Guns4d.play_sounds (sound_specs)
-
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()
for guns4d_soundspecsParameters:
- sound_specs
a guns4d_soundspec or a list of guns4d_soundspecs indexed my number. Also allows for shared fields. Example:
{ to_player = "singeplayer", min_distance = 100, --soundspec_to_play1 & soundspec_to_play2 share this parameter (as well as the to_player) soundspec_to_play1, soundspec_to_play2 }
Returns:
-
out a Guns4d sound handle (an integer)
- sound_specs
- Guns4d.stop_sounds (handle_list)
-
stops a list of sounds
Parameters:
- handle_list a list of minetest sound handles to stop, this is the returned output of @{guns4d.play_sounds
Tables
- guns4d_soundspec
-
defines a sound.
This is passed to
minetest.sound_play
as a sound parameter table however has the following changed or guns4d specific parameters.Fields:
- min_hear_distance
this is useful if you wish to play a sound which has a "far" sound, such as distant gunshots. incompatible
with to_player
- sounds
a weighted_randoms table for randomly selecting sounds. The output will overwrite the
sound
field. - to_player
4dguns changes
to_player
so it only plays positionless audio (as it is only intended for first person audio) - delay delay the playing of the sound
- min_hear_distance
this is useful if you wish to play a sound which has a "far" sound, such as distant gunshots. incompatible