diff options
author | Rogier <rogier777@gmail.com> | 2015-02-07 20:42:23 +0100 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2015-06-17 17:06:49 -0400 |
commit | fcef0ef987f7bd7d26d1c8a4d27a562822b580bc (patch) | |
tree | 3274e88dade0632dbb3c537f0564aea163f8ac81 /technic_chests | |
parent | ae7f49de385638c0c0ecc1be791bb044b369f5c7 (diff) |
Make chests usable if pipeworks is not installed
Diffstat (limited to 'technic_chests')
-rw-r--r-- | technic_chests/depends.txt | 2 | ||||
-rw-r--r-- | technic_chests/register.lua | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/technic_chests/depends.txt b/technic_chests/depends.txt index 3f0e5af..b9ca665 100644 --- a/technic_chests/depends.txt +++ b/technic_chests/depends.txt @@ -1,4 +1,4 @@ default moreores? -pipeworks +pipeworks? intllib? 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")}, |