sounds.lua 710 B

123456789101112131415161718192021
  1. --[[
  2. More Blocks: sound definitions
  3. Copyright © 2011-2021 Hugo Locurcio and contributors.
  4. Licensed under the zlib license. See LICENSE.md for more information.
  5. --]]
  6. local has_default_mod = minetest.get_modpath("default")
  7. for _, sound in ipairs({"dirt", "wood", "stone", "metal", "glass", "leaves"}) do
  8. -- use sound-function from default if available
  9. -- otherwise fall back to a no-op function (no sounds)
  10. local sound_function_name = "node_sound_" .. sound .. "_defaults"
  11. if has_default_mod then
  12. -- use default sounds
  13. moreblocks[sound_function_name] = default[sound_function_name]
  14. else
  15. -- no-op
  16. moreblocks[sound_function_name] = function() end
  17. end
  18. end