From 3780d9964e9f4ab7b1150d4ba551cb794b414420 Mon Sep 17 00:00:00 2001 From: OgelGames Date: Tue, 26 Jan 2021 19:02:52 +1100 Subject: [PATCH] add craft recipes --- README.md | 1 - crafts.lua | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ init.lua | 4 +++ mod.conf | 4 +-- 4 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 crafts.lua diff --git a/README.md b/README.md index 014c542..5958f46 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ Adds nodes to control the flow of digiline messages. ## TODO - router (sorting tube for digiline messages) -- craft recipes ## License diff --git a/crafts.lua b/crafts.lua new file mode 100644 index 0000000..e11f63e --- /dev/null +++ b/crafts.lua @@ -0,0 +1,72 @@ + +local function get_craftitem(items) + for _,item in ipairs(items) do + if minetest.registered_items[item] then + return item + end + end + return "???" +end + +local digiwire = "digilines:wire_std_00000000" + +local silicon = get_craftitem({ + "basic_materials:silicon", + "mesecons_materials:silicon", + "default:flint" +}) + +local wire = get_craftitem({ + "basic_materials:steel_wire", + "default:steel_ingot" +}) + +local ic = get_craftitem({ + "basic_materials:ic", + "default:mese_crystal_fragment" +}) + +minetest.register_craft({ + output = "digicontrol:diode", + recipe = { + {"", "", ""}, + {digiwire, silicon, digiwire}, + {"", "", ""}, + }, +}) + +minetest.register_craft({ + output = "digicontrol:splitter", + recipe = { + {"", "", digiwire}, + {digiwire, silicon, ""}, + {"", "", digiwire}, + }, +}) + +minetest.register_craft({ + output = "digicontrol:trisplitter", + recipe = { + {"", "", digiwire}, + {digiwire, silicon, digiwire}, + {"", "", digiwire}, + }, +}) + +minetest.register_craft({ + output = "digicontrol:limiter", + recipe = { + {"", "", ""}, + {digiwire, wire, digiwire}, + {"", "", ""}, + }, +}) + +minetest.register_craft({ + output = "digicontrol:filter", + recipe = { + {"", "", ""}, + {digiwire, ic, digiwire}, + {"", "", ""}, + }, +}) diff --git a/init.lua b/init.lua index ed5ae43..4e2c5cb 100644 --- a/init.lua +++ b/init.lua @@ -58,3 +58,7 @@ dofile(MP.."/trisplitter.lua") dofile(MP.."/filter.lua") dofile(MP.."/limiter.lua") --dofile(MP.."/router.lua") + +-- Crafting recipes +dofile(MP.."/crafts.lua") + diff --git a/mod.conf b/mod.conf index ef84fe7..edc7754 100644 --- a/mod.conf +++ b/mod.conf @@ -1,5 +1,5 @@ name = digicontrol description = Adds nodes to control the flow of digiline messages depends = default, digilines -optional_depends = digistuff -min_minetest_version = 5.0 \ No newline at end of file +optional_depends = basic_materials, mesecons_materials +min_minetest_version = 5.0