@@ -849,24 +849,39 @@ A positional sound will only be heard by players that are within
849
849
`SimpleSoundSpec`
850
850
-----------------
851
851
852
- * e.g. `""`
853
- * e.g. `"default_place_node"`
854
- * e.g. `{}`
855
- * e.g. `{name = "default_place_node"}`
856
- * e.g. `{name = "default_place_node", gain = 1.0}`
857
- * e.g. `{name = "default_place_node", gain = 1.0, pitch = 1.0}`
852
+ Specifies a sound name, gain (=volume) and pitch.
853
+ This is either a string or a table.
858
854
855
+ In string form, you just specify the sound name or
856
+ the empty string for no sound.
857
+
858
+ Table form has the following fields:
859
+
860
+ * `name`: Sound name
861
+ * `gain`: Volume (`1.0` = 100%)
862
+ * `pitch`: Pitch (`1.0` = 100%)
863
+
864
+ `gain` and `pitch` are optional and default to `1.0`.
865
+
866
+ Examples:
867
+
868
+ * `""`: No sound
869
+ * `{}`: No sound
870
+ * `"default_place_node"`: Play e.g. `default_place_node.ogg`
871
+ * `{name = "default_place_node"}`: Same as above
872
+ * `{name = "default_place_node", gain = 0.5}`: 50% volume
873
+ * `{name = "default_place_node", gain = 0.9, pitch = 1.1}`: 90% volume, 110% pitch
859
874
860
875
Special sound files
861
876
-------------------
862
877
863
878
These sound files are played back by the engine if provided.
864
879
865
- * `main_menu`: Looped sound in the main menu (gain = 1.0)
866
880
* `player_damage`: Played when the local player takes damage (gain = 0.5)
867
881
* `player_falling_damage`: Played when the local player takes
868
882
damage by falling (gain = 0.5)
869
-
883
+ * `default_dig_<groupname>`: Default node digging sound
884
+ (see node sound definition for details)
870
885
871
886
Registered definitions
872
887
======================
@@ -6468,9 +6483,14 @@ Used by `minetest.register_node`, `minetest.register_craftitem`, and
6468
6483
-- upon digging. Server will always update actual result shortly.
6469
6484
6470
6485
sound = {
6471
- breaks = "default_tool_break", -- tools only
6472
- place = <SimpleSoundSpec>,
6486
+ -- Definition of items sounds to be played at various events.
6487
+ -- All fields in this table are optional.
6488
+
6489
+ breaks = <SimpleSoundSpec>,
6490
+ -- When tool breaks due to wear. Ignored for non-tools
6491
+
6473
6492
eat = <SimpleSoundSpec>,
6493
+ -- When item is eaten with `minetest.do_item_eat`
6474
6494
},
6475
6495
6476
6496
on_place = function(itemstack, placer, pointed_thing),
@@ -6679,12 +6699,33 @@ Used by `minetest.register_node`.
6679
6699
-- liquid, flowingliquid drawtypes can only wave like liquids.
6680
6700
6681
6701
sounds = {
6702
+ -- Definition of node sounds to be played at various events.
6703
+ -- All fields in this table are optional.
6704
+
6682
6705
footstep = <SimpleSoundSpec>,
6683
- dig = <SimpleSoundSpec>, -- "__group" = group-based sound (default)
6706
+ -- If walkable, played when object walks on it. If node is
6707
+ -- climbable or a liquid, played when object moves through it
6708
+
6709
+ dig = <SimpleSoundSpec> or "__group",
6710
+ -- While digging node.
6711
+ -- If `"__group"`, then the sound will be
6712
+ -- `default_dig_<groupname>`, where `<groupname>` is the
6713
+ -- name of the tool's digging group with the fastest digging time.
6714
+ -- In case of a tie, one of the sounds will be played (but we
6715
+ -- cannot predict which one)
6716
+ -- Default value: `"__group"`
6717
+
6684
6718
dug = <SimpleSoundSpec>,
6719
+ -- Node was dug
6720
+
6685
6721
place = <SimpleSoundSpec>,
6722
+ -- Node was placed. Also played after falling
6723
+
6686
6724
place_failed = <SimpleSoundSpec>,
6725
+ -- When node placement failed
6726
+
6687
6727
fall = <SimpleSoundSpec>,
6728
+ -- When node starts to fall
6688
6729
},
6689
6730
6690
6731
drop = "",
0 commit comments