register tests only if enabled (#38)

Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
This commit is contained in:
Buckaroo Banzai 2024-08-19 07:07:07 +02:00 committed by GitHub
parent cb6471e266
commit 655486f465
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -44,7 +44,7 @@ end)
dofile(modpath .. "/src/commands.lua") dofile(modpath .. "/src/commands.lua")
if minetest.get_modpath("mtt") then if minetest.get_modpath("mtt") and mtt.enabled then
-- register tests -- register tests
dofile(modpath .. "/mtt.lua") dofile(modpath .. "/mtt.lua")
end end

View File

@ -4,4 +4,7 @@ mtt.emerge_area({ x=0, y=0, z=0 }, { x=10, y=10, z=10 })
-- check nodelist -- check nodelist
local mtt_nodelist = minetest.settings:get("mtt_nodelist") local mtt_nodelist = minetest.settings:get("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) mtt.validate_nodenames(minetest.get_modpath("xcompat") .. "/test/nodelist/" .. mtt_nodelist)
end