add mcl_formspec to optional depends with code check

This commit is contained in:
tenplus1 2022-02-05 08:14:31 +00:00
parent 1c65d3fd61
commit dbb049726e
3 changed files with 29 additions and 24 deletions

@ -3,3 +3,5 @@ intllib?
lucky_block?
mesecons_mvps?
playerfactions?
mcl_core?
mcl_formspec?

@ -8,6 +8,7 @@ local F = minetest.formspec_escape
-- MineClone2 support
local mcl = minetest.get_modpath("mcl_core")
local mcf = minetest.get_modpath("mcl_formspec")
-- Are crafts enabled?
local protector_crafts = minetest.settings:get_bool("protector_crafts") ~= false
@ -364,29 +365,31 @@ register_door(name, {
})
if protector_crafts then
if mcl then
minetest.register_craft({
output = name,
recipe = {
{"mcl_doors:iron_door", "mcl_core:gold_ingot"}
}
})
else
minetest.register_craft({
output = name,
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:copper_ingot"},
{"default:steel_ingot", "default:steel_ingot"}
}
})
minetest.register_craft({
output = name,
recipe = {
{"doors:door_steel", "default:copper_ingot"}
}
})
if mcl then
minetest.register_craft({
output = name,
recipe = {
{"mcl_doors:iron_door", "mcl_core:gold_ingot"}
}
})
else
minetest.register_craft({
output = name,
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:copper_ingot"},
{"default:steel_ingot", "default:steel_ingot"}
}
})
minetest.register_craft({
output = name,
recipe = {
{"doors:door_steel", "default:copper_ingot"}
}
})
end
end
@ -637,7 +640,7 @@ minetest.register_node("protector:chest", {
local formspec
-- mineclone support
if mcl then
if mcl and mcf then
formspec = "size[9,8.75]"
.. "label[0,0;" .. minetest.formspec_escape(

@ -1,3 +1,3 @@
name = protector
description = Lets players craft special blocks to protect their builds or disable PVP in areas.
optional_depends = default, intllib, lucky_block, mesecons_mvps, playerfactions, mcl_core
optional_depends = default, intllib, lucky_block, mesecons_mvps, playerfactions, mcl_core, mcl_formspec