From dfcf64c1d07f4006045af37b0b01dbfc82dbb1d1 Mon Sep 17 00:00:00 2001
From: SmallJoker <mk939@ymail.com>
Date: Sat, 26 Aug 2023 10:57:05 +0200
Subject: [PATCH] Chainsaw: new setting to disable safe cutting

---
 technic_chests/init.lua |   75 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 72 insertions(+), 3 deletions(-)

diff --git a/technic_chests/init.lua b/technic_chests/init.lua
index 1afbf54..188e516 100644
--- a/technic_chests/init.lua
+++ b/technic_chests/init.lua
@@ -2,12 +2,81 @@
 -- namespace: technic
 -- (c) 2012-2013 by RealBadAngel <mk@realbadangel.pl>
 
-modpath=minetest.get_modpath("technic_chests")
+local modpath = minetest.get_modpath("technic_chests")
 
--- chests
-dofile(modpath.."/chest_commons.lua")
+technic = rawget(_G, "technic") or {}
+technic.chests = {}
+
+dofile(modpath.."/common.lua")
+dofile(modpath.."/register.lua")
 dofile(modpath.."/iron_chest.lua")
 dofile(modpath.."/copper_chest.lua")
 dofile(modpath.."/silver_chest.lua")
 dofile(modpath.."/gold_chest.lua")
 dofile(modpath.."/mithril_chest.lua")
+
+-- undo all of the locked wooden chest recipes created by default and
+-- moreblocks, and just make them use a padlock.
+
+if minetest.get_modpath("moreblocks") then
+	minetest.clear_craft({
+		type = "shapeless",
+		recipe = {
+			"default:chest",
+			"default:gold_ingot",
+		}
+	})
+
+	minetest.clear_craft({
+		type = "shapeless",
+		recipe = {
+			"default:chest",
+			"default:bronze_ingot",
+		}
+	})
+
+	minetest.clear_craft({
+		type = "shapeless",
+		recipe = {
+			"default:chest",
+			"default:copper_ingot",
+		}
+	})
+end
+
+minetest.clear_craft({
+	type = "shapeless",
+	recipe = {
+		"default:chest",
+		"default:steel_ingot",
+	}
+})
+
+minetest.clear_craft({output = "default:chest_locked"})
+
+minetest.register_craft({
+	output = "default:chest_locked",
+	recipe = {
+		{ "group:wood", "group:wood", "group:wood" },
+		{ "group:wood", "basic_materials:padlock", "group:wood" },
+		{ "group:wood", "group:wood", "group:wood" }
+	}
+})
+
+minetest.register_craft({
+	output = "default:chest_locked",
+	type = "shapeless",
+	recipe = {
+		"default:chest",
+		"basic_materials:padlock"
+	}
+})
+
+minetest.register_lbm({
+	name = "technic_chests:fix_wooden_chests",
+	nodenames = {"default:chest"},
+	action = function(pos, node)
+		local meta = minetest.get_meta(pos)
+		meta:set_string("formspec", "")
+	end
+})

--
Gitblit v1.8.0