From a4c0e2a759f211dcc3f2a652b1b78fd7f73bfb07 Mon Sep 17 00:00:00 2001 From: theFox6 Date: Wed, 4 Mar 2020 16:46:22 +0100 Subject: [PATCH] added craft recipies --- api.lua | 48 +++++++++++++-------------- modules/network/ctrl.lua | 14 ++++++++ modules/shared/init.lua | 2 +- modules/storage/api.lua | 31 ++++++++--------- modules/storage/drive.lua | 8 +++++ modules/storage/storage.lua | 38 +++++++++++++++++++++ modules/storage/terminal.lua | 8 +++++ textures/microexpansion_cell_32k.png | Bin 547 -> 450 bytes textures/microexpansion_cell_8k.png | Bin 534 -> 451 bytes 9 files changed, 107 insertions(+), 42 deletions(-) diff --git a/api.lua b/api.lua index 79c9a65..17c343d 100644 --- a/api.lua +++ b/api.lua @@ -64,35 +64,35 @@ function microexpansion.register_item(itemstring, def) -- Register craftitem minetest.register_craftitem(BASENAME..":"..itemstring, def) - -- if recipe, Register recipe - if def.recipe then - microexpansion.register_recipe(BASENAME..":"..itemstring, def.recipe) - end + -- if recipe, Register recipe + if def.recipe then + microexpansion.register_recipe(BASENAME..":"..itemstring, def.recipe) + end end -- [function] Register Node function microexpansion.register_node(itemstring, def) - -- Check if disabled - if def.disabled == true then - return - end - -- Set usedfor - if def.usedfor then - def.description = def.description .. "\n"..minetest.colorize("grey", def.usedfor) - end - -- Update texture - if def.auto_complete ~= false then - for _,i in ipairs(def.tiles) do - if #def.tiles[_]:split("^") <= 1 then - local prefix = "" - if def.type == "ore" then - prefix = "ore_" - end + -- Check if disabled + if def.disabled == true then + return + end + -- Set usedfor + if def.usedfor then + def.description = def.description .. "\n"..minetest.colorize("grey", def.usedfor) + end + -- Update texture + if def.auto_complete ~= false then + for i,n in ipairs(def.tiles) do + if #def.tiles[i]:split("^") <= 1 then + local prefix = "" + if def.type == "ore" then + prefix = "ore_" + end - def.tiles[_] = BASENAME.."_"..prefix..i..".png" - end - end - end + def.tiles[i] = BASENAME.."_"..prefix..n..".png" + end + end + end -- Colour description def.description = desc_colour(def.status, def.description) -- Update connect_sides diff --git a/modules/network/ctrl.lua b/modules/network/ctrl.lua index 90c8c62..374f7e0 100644 --- a/modules/network/ctrl.lua +++ b/modules/network/ctrl.lua @@ -14,6 +14,14 @@ me.register_node("ctrl", { "ctrl_sides", "ctrl_sides" }, + recipe = { + { 1, { + {"default:steel_ingot", "microexpansion:steel_infused_obsidian_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "microexpansion:machine_casing", "default:steel_ingot"}, + {"default:steel_ingot", "microexpansion:cable", "default:steel_ingot"}, + }, + } + }, drawtype = "nodebox", paramtype = "light", node_box = { @@ -75,6 +83,12 @@ me.register_machine("cable", { tiles = { "cable", }, + recipe = { + { 12, "shapeless", { + "microexpansion:steel_infused_obsidian_ingot", "microexpansion:machine_casing" + }, + } + }, drawtype = "nodebox", node_box = { type = "connected", diff --git a/modules/shared/init.lua b/modules/shared/init.lua index 87e1256..befb806 100644 --- a/modules/shared/init.lua +++ b/modules/shared/init.lua @@ -9,7 +9,7 @@ local me = microexpansion me.register_item("steel_infused_obsidian_ingot", { description = "Steel Infused Obsidian Ingot", recipe = { - { 1, { + { 2, { { "default:steel_ingot", "default:obsidian_shard", "default:steel_ingot" }, }, }, diff --git a/modules/storage/api.lua b/modules/storage/api.lua index dd9fcb4..85ecc47 100644 --- a/modules/storage/api.lua +++ b/modules/storage/api.lua @@ -24,10 +24,7 @@ function microexpansion.register_cell(itemstring, def) -- if recipe, register recipe if def.recipe then - -- if recipe, register recipe - if def.recipe then - microexpansion.register_recipe(BASENAME..":"..itemstring, def.recipe) - end + microexpansion.register_recipe(BASENAME..":"..itemstring, def.recipe) end end @@ -67,20 +64,20 @@ function microexpansion.move_inv(inv1, inv2, max) if v:get_count() > left then v = v:peek_item(left) end - if tinv and tinv:room_for_item(tname, v) then - if huge then - microexpansion.insert_item(v, tinv, tname) - finv:remove_item(fname, v) - else - local leftover = tinv:add_item(tname, v) + if tinv and tinv:room_for_item(tname, v) then + if huge then + microexpansion.insert_item(v, tinv, tname) + finv:remove_item(fname, v) + else + local leftover = tinv:add_item(tname, v) finv:remove_item(fname, v) if leftover and not(leftover:is_empty()) then minetest.log("warning","leftover items when transfering inventory") - finv:add_item(fname, leftover) - end - end - inserted = inserted + v:get_count() - end - end - end + finv:add_item(fname, leftover) + end + end + inserted = inserted + v:get_count() + end + end + end end diff --git a/modules/storage/drive.lua b/modules/storage/drive.lua index 953f8b1..8c52fd3 100644 --- a/modules/storage/drive.lua +++ b/modules/storage/drive.lua @@ -32,6 +32,14 @@ microexpansion.register_node("drive", { "chest_side", "drive_full", }, + recipe = { + { 1, { + {"default:steel_ingot", "default:chest", "default:steel_ingot" }, + {"default:steel_ingot", "microexpansion:machine_casing", "default:steel_ingot" }, + {"default:steel_ingot", "default:chest", "default:steel_ingot" }, + }, + } + }, is_ground_content = false, groups = { cracky = 1, me_connect = 1 }, paramtype = "light", diff --git a/modules/storage/storage.lua b/modules/storage/storage.lua index 394adde..3eaa61c 100644 --- a/modules/storage/storage.lua +++ b/modules/storage/storage.lua @@ -1,43 +1,81 @@ -- microexpansion/storage.lua +--TODO: use storagecomp for crafting + -- [drive] 8k microexpansion.register_cell("cell_1k", { description = "1k ME Storage Cell", capacity = 1000, + recipe = { + { 1, { + {"default:tin_ingot", "default:copper_ingot", "default:tin_ingot"}, + {"default:copper_ingot","microexpansion:steel_infused_obsidian_ingot","default:copper_ingot"}, + {"default:tin_ingot", "default:copper_ingot", "default:tin_ingot"}, + }, + } + }, }) -- [drive] 8k microexpansion.register_cell("cell_2k", { description = "2k ME Storage Cell", capacity = 2000, + recipe = { + { 1, { + {"default:copper_ingot","default:steel_ingot", "default:copper_ingot"}, + {"default:steel_ingot", "default:obsidian_shard", "default:steel_ingot"}, + {"default:copper_ingot","default:steel_ingot", "default:copper_ingot"}, + }, + }, + { 1, "shapeless", {"microexpansion:cell_1k","microexpansion:cell_1k"}} + }, }) -- [drive] 16k microexpansion.register_cell("cell_4k", { description = "4k ME Storage Cell", capacity = 4000, + recipe = { + { 1, "shapeless", { + "microexpansion:steel_infused_obsidian_ingot", "microexpansion:machine_casing", "microexpansion:steel_infused_obsidian_ingot" + }, + }, + { 1, "shapeless", {"microexpansion:cell_2k","microexpansion:cell_2k"}} + }, }) -- [drive] 16k microexpansion.register_cell("cell_8k", { description = "8k ME Storage Cell", capacity = 8000, + recipe = { + { 1, "shapeless", {"microexpansion:cell_4k","microexpansion:cell_4k"}} + }, }) -- [drive] 32k microexpansion.register_cell("cell_16k", { description = "16k ME Storage Cell", capacity = 16000, + recipe = { + { 1, "shapeless", {"microexpansion:cell_8k","microexpansion:cell_8k"}} + }, }) -- [drive] 32k microexpansion.register_cell("cell_32k", { description = "32k ME Storage Cell", capacity = 32000, + recipe = { + { 1, "shapeless", {"microexpansion:cell_16k","microexpansion:cell_16k"}} + }, }) -- [drive] 64k microexpansion.register_cell("cell_64k", { description = "64k ME Storage Cell", capacity = 64000, + recipe = { + { 1, "shapeless", {"microexpansion:cell_32k","microexpansion:cell_32k"}} + }, }) diff --git a/modules/storage/terminal.lua b/modules/storage/terminal.lua index fd6f0bc..f33cf2c 100644 --- a/modules/storage/terminal.lua +++ b/modules/storage/terminal.lua @@ -93,6 +93,14 @@ microexpansion.register_node("term", { "chest_side", "chest_front", }, + recipe = { + { 1, { + {"default:steel_ingot", "default:chest", "default:steel_ingot"}, + {"default:steel_ingot", "microexpansion:machine_casing", "default:steel_ingot"}, + {"default:steel_ingot", "microexpansion:cable", "default:steel_ingot"}, + }, + } + }, is_ground_content = false, groups = { cracky = 1, me_connect = 1 }, paramtype = "light", diff --git a/textures/microexpansion_cell_32k.png b/textures/microexpansion_cell_32k.png index 17fd44f18ad54b142d48f52e3181c443b21f8061..6e7f579c2f60d89cd663961272a774068e214ca3 100644 GIT binary patch delta 399 zcmV;A0dW4K1i}N5J%0|u000ic0Tn1pfB*mh2XskIMF->q1P>`V?%RI*0003`Nkl*ODZI<8z1fmXxKvzL%hrUrka4iTK)GWnr;v%k&eFH=8 zaJP^SMKO}7(6e1G=RY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