From ece52511869c1ec0f90b55e5351c5d8b46e88cfc Mon Sep 17 00:00:00 2001 From: Pierre-Yves Rollo Date: Sun, 9 Dec 2018 18:04:25 +0100 Subject: [PATCH] Added craft recipes --- crafts.lua | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++ depends.txt | 8 ++++++ init.lua | 2 +- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 crafts.lua diff --git a/crafts.lua b/crafts.lua new file mode 100644 index 0000000..2ab79cc --- /dev/null +++ b/crafts.lua @@ -0,0 +1,78 @@ +--[[ + digiterms mod for Minetest - Digilines monitors using Display API / Font API + (c) Pierre-Yves Rollo + + This file is part of digiterms. + + signs is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + signs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with signs. If not, see . +--]] + +local function material_fallback(list) + for _, material in ipairs(list) do + if minetest.registered_items[material] then + return material + end + end +end + +local body = material_fallback({ + 'homedecor:plastic_sheeting', + 'default:steel_ingot', +}) + +local glass = material_fallback({ + 'xpanes:pane_flat', + 'default:glass', +}) + +local electronic = material_fallback({ + 'mesecons_microcontroller:microcontroller0000', + 'mesecons_luacontroller:luacontroller0000', + 'default:copper_ingot', +}) + +local wire = 'digilines:wire_std_00000000' + +print("Craft materials:") +print("Body: "..(body or "None!")) +print("Glass: "..(glass or "None!")) +print("Electronic: "..(electronic or "None!")) +print("Wire: "..(wire or "None!")) + +minetest.register_craft({ + output = "digiterms:lcd_monitor 1", + recipe = { + {body, electronic, ''}, + {glass, material_fallback({'mesecons_materials:silicon', 'dye:black'}), ''}, + {body, wire, ''} + } +}) + +minetest.register_craft({ + output = "digiterms:cathodic_amber_monitor", + recipe = { + {body, body, ''}, + {glass, 'dye:orange', electronic}, + {body, body, wire} + } +}) + +minetest.register_craft({ + output = "digiterms:cathodic_green_monitor 1", + recipe = { + {body, body, ''}, + {glass, 'dye:green', electronic}, + {body, body, wire} + } +}) diff --git a/depends.txt b/depends.txt index cf4425b..771586c 100644 --- a/depends.txt +++ b/depends.txt @@ -1,4 +1,12 @@ display_api font_api digilines +dye +default +xpane? scifi_nodes? +basic_materials? +homedecor? +mesecons_microcontroller? +mesecons_luacontroller? +mesecons_materials? diff --git a/init.lua b/init.lua index bb3cc69..8a74227 100644 --- a/init.lua +++ b/init.lua @@ -26,7 +26,7 @@ digiterms.font = "mozart" dofile(digiterms.path.."/font_mozart.lua") dofile(digiterms.path.."/functions.lua") dofile(digiterms.path.."/nodes.lua") ---dofile(digiterms.path.."/crafts.lua") +dofile(digiterms.path.."/crafts.lua") if minetest.get_modpath("scifi_nodes") then print ('[digiterms] scifi_nodes present, adding some more nodes')