From 7dfea8748a7393c270a426a84b52dc3a1394fd74 Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Sun, 6 Feb 2022 11:08:10 -0500 Subject: [PATCH] graceful user error fallback --- nodes.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/nodes.lua b/nodes.lua index 01f9553..f8e0591 100644 --- a/nodes.lua +++ b/nodes.lua @@ -1,7 +1,20 @@ local S = minetest.get_translator("basic_materials") -local sound_api = dofile(basic_materials.modpath .. "/sound_api_core/init.lua") local chains_sbox = {type = "fixed",fixed = { -0.1, -0.5, -0.1, 0.1, 0.5, 0.1 }} +local sound_api = loadfile(basic_materials.modpath .. "/sound_api_core/init.lua") +if not sound_api then + sound_api = {} + local metatable = { + __index = function(_, _) + return function(input) + minetest.log("warning", "[basic_materials]: sounds not found") + if input then return input else return nil end + end + end, + } + setmetatable(sound_api, metatable) +end + minetest.register_node("basic_materials:cement_block", { description = S("Cement"), tiles = {"basic_materials_cement_block.png"},