From 655486f465704a49e4bc5349a599e7f8761cca69 Mon Sep 17 00:00:00 2001 From: Buckaroo Banzai <39065740+BuckarooBanzay@users.noreply.github.com> Date: Mon, 19 Aug 2024 07:07:07 +0200 Subject: [PATCH] register tests only if enabled (#38) Co-authored-by: BuckarooBanzay --- init.lua | 2 +- mtt.lua | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index a1f5e2e..c4c622f 100644 --- a/init.lua +++ b/init.lua @@ -44,7 +44,7 @@ end) dofile(modpath .. "/src/commands.lua") -if minetest.get_modpath("mtt") then +if minetest.get_modpath("mtt") and mtt.enabled then -- register tests dofile(modpath .. "/mtt.lua") end diff --git a/mtt.lua b/mtt.lua index a8a15a5..e407cfe 100644 --- a/mtt.lua +++ b/mtt.lua @@ -4,4 +4,7 @@ mtt.emerge_area({ x=0, y=0, z=0 }, { x=10, y=10, z=10 }) -- check nodelist local mtt_nodelist = minetest.settings:get("mtt_nodelist") -mtt.validate_nodenames(minetest.get_modpath("xcompat") .. "/test/nodelist/" .. mtt_nodelist) +if mtt_nodelist then + -- nodelist specified, check if all the required nodes are present + mtt.validate_nodenames(minetest.get_modpath("xcompat") .. "/test/nodelist/" .. mtt_nodelist) +end \ No newline at end of file