From fcef0ef987f7bd7d26d1c8a4d27a562822b580bc Mon Sep 17 00:00:00 2001
From: Rogier <rogier777@gmail.com>
Date: Wed, 17 Jun 2015 23:06:49 +0200
Subject: [PATCH] Make chests usable if pipeworks is not installed

---
 technic_chests/register.lua |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/technic_chests/register.lua b/technic_chests/register.lua
index f1912f5..dcd3fb3 100644
--- a/technic_chests/register.lua
+++ b/technic_chests/register.lua
@@ -1,5 +1,22 @@
 local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
 
+local pipeworks = rawget(_G, "pipeworks")
+if not minetest.get_modpath("pipeworks") then
+	-- Pipeworks is not installed. Simulate using a dummy table...
+	pipeworks = {}
+	local pipeworks_meta = {}
+	setmetatable(pipeworks, pipeworks_meta)
+	local dummy = function()
+		end
+	pipeworks_meta.__index = function(table, key)
+			print("[technic_chests] WARNING: variable or method '"..key.."' not present in dummy pipeworks table - assuming it is a method...")
+			pipeworks[key] = dummy
+			return dummy
+		end
+	pipeworks.after_place = dummy
+	pipeworks.after_dig = dummy
+end
+
 local chest_mark_colors = {
 	{"black", S("Black")},
 	{"blue", S("Blue")},

--
Gitblit v1.8.0