From dbb049726eb8306c80b0f59ceb9f7a96f44a04fd Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Sat, 5 Feb 2022 08:14:31 +0000 Subject: [PATCH] add mcl_formspec to optional depends with code check --- depends.txt | 2 ++ doors_chest.lua | 49 ++++++++++++++++++++++++++----------------------- mod.conf | 2 +- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/depends.txt b/depends.txt index 5b09c28..daa563a 100644 --- a/depends.txt +++ b/depends.txt @@ -3,3 +3,5 @@ intllib? lucky_block? mesecons_mvps? playerfactions? +mcl_core? +mcl_formspec? diff --git a/doors_chest.lua b/doors_chest.lua index 2218fa4..2793b82 100644 --- a/doors_chest.lua +++ b/doors_chest.lua @@ -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( diff --git a/mod.conf b/mod.conf index 36e756b..5d90f01 100644 --- a/mod.conf +++ b/mod.conf @@ -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