Script play_sound

implements tools for quickly playing audio.

Functions

Guns4d.play_sound (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.

Tables

guns4d_soundspec defines a sound.


Functions

Guns4d.play_sound (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_soundspecs

Parameters:

  • 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 list of Minetest sound handles [insert link] (in the order they came)

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 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)
generated by LDoc 1.5.0 Last updated 2024-01-19 14:08:01