From a3d434de0636ae6ec67de0362e40f36e95c26d55 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 7 Aug 2022 20:23:28 +0200 Subject: [PATCH] Document rp_sounds API --- DEVELOPERS.md | 1 + mods/rp_sounds/API.md | 44 +++++++++++++++++++++++++++++++++++++++ mods/rp_sounds/README.txt | 4 +++- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 mods/rp_sounds/API.md diff --git a/DEVELOPERS.md b/DEVELOPERS.md index db0edb3..4d8f634 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -52,6 +52,7 @@ Mods with documented APIs: * `rp_partialblocks`: Register partial blocks (slabs, stairs) * `rp_player`: Player model handling, model animation, textures * `rp_player_effects`: Add player effects (required if you want to modify player physics) +* `rp_sounds`: Node sounds * `rp_util`: Helper functions for Repixture * `tt`: Custom tooltips diff --git a/mods/rp_sounds/API.md b/mods/rp_sounds/API.md new file mode 100644 index 0000000..5fe60b6 --- /dev/null +++ b/mods/rp_sounds/API.md @@ -0,0 +1,44 @@ +## Functions + +This mod gives you the node sounds. You need these helper +functions to give nodes sounds. + +### Basic function syntax + +Every function returns a value that you can use to set the node's +`sounds` argument with. You can choose between stone, dirt, sand, +and other sounds. There is an optional argument `table` in which +you can override the default sound table returned by this +function. The syntax of this table is the same as for the node's +`sound` field in the node registration function, with the difference +that the keys included in this table will be the ones to override. + +Examples: + + rp_sounds.node_sound_wood_defaults() + +Returns a sound definition for wooden node sounds. + + + + rp_sounds.node_sound_dirt_defaults({ + footstep = {name="default_hard_footstep", gain=0.6} + }) + +Returns a sound definition with dirt sounds, except the footstep +sound was changed to `default_hard_footstep`. + + +### List of functions + +These are the available functions: + +* `rp_sounds.node_sound_defaults(table)`: Default/fallback sounds +* `rp_sounds.node_sound_stone_defaults(table)`: Stone +* `rp_sounds.node_sound_dirt_defaults(table)`: Dirt +* `rp_sounds.node_sound_sand_defaults(table)`: Sand +* `rp_sounds.node_sound_wood_defaults(table)`: Wood, tree, etc. +* `rp_sounds.node_sound_leaves_defaults(table)`: Leaves +* `rp_sounds.node_sound_glass_defaults(table)`: Glass +* `rp_sounds.node_sound_snow_defaults(table)`: Snow +* `rp_sounds.node_sound_water_defaults(table)`: Water diff --git a/mods/rp_sounds/README.txt b/mods/rp_sounds/README.txt index 457a74b..b21b2c6 100644 --- a/mods/rp_sounds/README.txt +++ b/mods/rp_sounds/README.txt @@ -1,6 +1,8 @@ Repixure mod: rp_sounds ======================= -Node sound functions for Repixture +Node sound functions for Repixture. + +Developers: See `API.md` for instructions. Sound licenses: * Water sounds: