From ae7f49de385638c0c0ecc1be791bb044b369f5c7 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 without moreores (& add soft dependency) --- technic_chests/mithril_chest.lua | 34 +++++++++-------- technic_chests/depends.txt | 1 technic_chests/gold_chest.lua | 42 +++++++++++++-------- technic_chests/silver_chest.lua | 34 +++++++++-------- 4 files changed, 63 insertions(+), 48 deletions(-) diff --git a/technic_chests/depends.txt b/technic_chests/depends.txt index 4d04e9d..3f0e5af 100644 --- a/technic_chests/depends.txt +++ b/technic_chests/depends.txt @@ -1,3 +1,4 @@ default +moreores? pipeworks intllib? diff --git a/technic_chests/gold_chest.lua b/technic_chests/gold_chest.lua index 161d8fe..c66b2f6 100644 --- a/technic_chests/gold_chest.lua +++ b/technic_chests/gold_chest.lua @@ -1,21 +1,31 @@ -minetest.register_craft({ - output = 'technic:gold_chest', - recipe = { - {'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, - {'default:gold_ingot','technic:silver_chest','default:gold_ingot'}, - {'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, - } -}) +local material_list +if minetest.get_modpath("moreores") then + material_list = { 'silver' } +else + -- Make the gold chest obtainable for mere mortals (the silver chest is not obtainable) + material_list = { 'copper', 'silver' } +end -minetest.register_craft({ - output = 'technic:gold_locked_chest', - recipe = { - {'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, - {'default:gold_ingot','technic:silver_locked_chest','default:gold_ingot'}, - {'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, - } -}) +for _, material in ipairs(material_list) do + minetest.register_craft({ + output = 'technic:gold_chest', + recipe = { + {'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, + {'default:gold_ingot',"technic:"..material.."_chest",'default:gold_ingot'}, + {'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, + } + }) + + minetest.register_craft({ + output = 'technic:gold_locked_chest', + recipe = { + {'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, + {'default:gold_ingot',"technic:"..material.."_locked_chest",'default:gold_ingot'}, + {'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, + } + }) +end minetest.register_craft({ output = 'technic:gold_locked_chest', diff --git a/technic_chests/mithril_chest.lua b/technic_chests/mithril_chest.lua index bd2b981..909ff9e 100644 --- a/technic_chests/mithril_chest.lua +++ b/technic_chests/mithril_chest.lua @@ -1,20 +1,22 @@ -minetest.register_craft({ - output = 'technic:mithril_chest 1', - recipe = { - {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, - {'moreores:mithril_ingot','technic:gold_chest','moreores:mithril_ingot'}, - {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, - } -}) +if minetest.get_modpath("moreores") then + minetest.register_craft({ + output = 'technic:mithril_chest 1', + recipe = { + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','technic:gold_chest','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + } + }) -minetest.register_craft({ - output = 'technic:mithril_locked_chest 1', - recipe = { - {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, - {'moreores:mithril_ingot','technic:gold_locked_chest','moreores:mithril_ingot'}, - {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, - } -}) + minetest.register_craft({ + output = 'technic:mithril_locked_chest 1', + recipe = { + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','technic:gold_locked_chest','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + } + }) +end minetest.register_craft({ output = 'technic:mithril_locked_chest 1', diff --git a/technic_chests/silver_chest.lua b/technic_chests/silver_chest.lua index 505156a..c615304 100644 --- a/technic_chests/silver_chest.lua +++ b/technic_chests/silver_chest.lua @@ -1,20 +1,22 @@ -minetest.register_craft({ - output = 'technic:silver_chest', - recipe = { - {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, - {'moreores:silver_ingot','technic:copper_chest','moreores:silver_ingot'}, - {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, - } -}) +if minetest.get_modpath("moreores") then + minetest.register_craft({ + output = 'technic:silver_chest', + recipe = { + {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, + {'moreores:silver_ingot','technic:copper_chest','moreores:silver_ingot'}, + {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, + } + }) -minetest.register_craft({ - output = 'technic:silver_locked_chest', - recipe = { - {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, - {'moreores:silver_ingot','technic:copper_locked_chest','moreores:silver_ingot'}, - {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, - } -}) + minetest.register_craft({ + output = 'technic:silver_locked_chest', + recipe = { + {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, + {'moreores:silver_ingot','technic:copper_locked_chest','moreores:silver_ingot'}, + {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, + } + }) +end minetest.register_craft({ output = 'technic:silver_locked_chest', -- Gitblit v1.8.0