2024-02-25 06:10:30 +01:00
|
|
|
# Xcompat dev docs
|
2022-05-02 02:17:46 +02:00
|
|
|
|
2024-02-25 06:10:30 +01:00
|
|
|
## Sound API
|
2022-05-02 02:17:46 +02:00
|
|
|
|
2024-02-25 06:10:30 +01:00
|
|
|
### Option 1: Agnostically depend
|
2022-05-02 02:17:46 +02:00
|
|
|
|
|
|
|
You can do this by using a custom field in your node def instead of the `sounds` key.
|
|
|
|
|
|
|
|
```lua
|
|
|
|
minetest.register_node(nodename, {
|
|
|
|
...
|
|
|
|
_sound_def = {
|
|
|
|
key = "",
|
|
|
|
input = {},
|
|
|
|
},
|
|
|
|
...
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
|
|
|
where:
|
|
|
|
|
|
|
|
* key: string name of the field from the sound api you want to use, for example `node_sound_stone_defaults`
|
|
|
|
* input: table input of fields you want passed to the key field, used to override specific sounds.
|
|
|
|
|
2024-02-25 06:10:30 +01:00
|
|
|
### Option 2: Hard depend
|
2022-05-02 02:17:46 +02:00
|
|
|
|
|
|
|
add this mod to your mod.confs depends and directly call the sound_api as follows
|
|
|
|
|
|
|
|
```lua
|
|
|
|
minetest.register_node(nodename, {
|
|
|
|
...
|
2024-02-25 06:10:30 +01:00
|
|
|
sounds = xcompat.sounds.node_sound_stone_defaults(input)
|
2022-05-02 02:17:46 +02:00
|
|
|
...
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
|
|
|
* input: optional table to override some or all of returned values
|
|
|
|
|
2024-02-25 06:10:30 +01:00
|
|
|
## Materials API
|
|
|
|
|
|
|
|
consult `/src/materials.lua` at this time
|