From 30b7894dbe39992e4a7d737d78e94b9076734d37 Mon Sep 17 00:00:00 2001 From: James David Clarke Date: Tue, 19 Dec 2023 19:12:29 +0000 Subject: [PATCH] Added Support for Mineclone2,Mineclonia,Mineclone5 closes #13 --- mod.conf | 4 +-- modules/crafting/materials.lua | 26 ++++++++++++---- modules/crafting/shared.lua | 48 +++++++++++++++++++++++------- modules/item_transfer/exporter.lua | 8 ++--- modules/item_transfer/importer.lua | 8 ++--- modules/item_transfer/init.lua | 9 ++++++ modules/item_transfer/upgrades.lua | 2 +- modules/network/ctrl.lua | 32 +++++++++++++++----- modules/network/security.lua | 31 ++++++++++++++----- modules/power/gen.lua | 30 ++++++++++++++----- modules/storage/drive.lua | 29 +++++++++++++----- modules/storage/storage.lua | 29 ++++++++++++++++++ modules/storage/terminal.lua | 32 +++++++++++++++----- 13 files changed, 220 insertions(+), 68 deletions(-) diff --git a/mod.conf b/mod.conf index e678050..77698b6 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = microexpansion description = A storage managing solution to get an overview over all your items. -depends = default -optional_depends = pipeworks,basic_materials +optional_depends = pipeworks,basic_materials,mcl_furnaces,mcl_core +supported_games = mineclone2,mineclonia,minetest_game diff --git a/modules/crafting/materials.lua b/modules/crafting/materials.lua index 934a3ed..bb8d968 100644 --- a/modules/crafting/materials.lua +++ b/modules/crafting/materials.lua @@ -4,16 +4,30 @@ local me = microexpansion local substitute_basic_materials = microexpansion.settings.simple_craft == true or not minetest.get_modpath("basic_materials") +local gold_wire_recipe = nil --- [register item] Gold Wire -me.register_item("gold_wire", { - description = "Gold Wire", - groups = { wire = 1 }, - recipe = substitute_basic_materials and { +if minetest.get_modpath("mcl_core") then + gold_wire_recipe = { + { 2, { + {"mcl_core:gold_ingot", "mcl_core:stick"}, + {"mcl_core:stick", ""} + }, + }, + } +else + gold_wire_recipe = { { 2, { {"default:gold_ingot", "default:stick"}, {"default:stick", ""} }, }, - } or nil, + } + +end + +-- [register item] Gold Wire +me.register_item("gold_wire", { + description = "Gold Wire", + groups = { wire = 1 }, + recipe = substitute_basic_materials and gold_wire_recipe or nil, }) diff --git a/modules/crafting/shared.lua b/modules/crafting/shared.lua index ad80c5f..b6a5167 100644 --- a/modules/crafting/shared.lua +++ b/modules/crafting/shared.lua @@ -4,26 +4,52 @@ local me = microexpansion -- custom items that are used by multiple devices --- [register item] Steel Infused Obsidian Ingot -me.register_item("steel_infused_obsidian_ingot", { - description = "Steel Infused Obsidian Ingot", - recipe = { +local steel_infused_obsidian_ingot_recipe = nil +local machine_casing_recipe = nil + +if minetest.get_modpath("mcl_core") then + steel_infused_obsidian_ingot_recipe = { + { 2, { + { "mcl_core:iron_ingot", "mcl_core:obsidian", "mcl_core:iron_ingot" }, + }, + }, + } + + machine_casing_recipe = { + { 1, { + {"mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "mcl_copper:copper_ingot", "mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot"}, + }, + }, + } + +else + steel_infused_obsidian_ingot_recipe = { { 2, { { "default:steel_ingot", "default:obsidian_shard", "default:steel_ingot" }, }, }, - }, -}) + } --- [register item] Machine Casing -me.register_item("machine_casing", { - description = "Machine Casing", - recipe = { + machine_casing_recipe = { { 1, { {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, {"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"}, {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, }, }, - }, + } + +end +-- [register item] Steel Infused Obsidian Ingot +me.register_item("steel_infused_obsidian_ingot", { + description = "Steel Infused Obsidian Ingot", + recipe = steel_infused_obsidian_ingot_recipe, +}) + +-- [register item] Machine Casing +me.register_item("machine_casing", { + description = "Machine Casing", + recipe = machine_casing_recipe, }) diff --git a/modules/item_transfer/exporter.lua b/modules/item_transfer/exporter.lua index 04b6215..4f0dbe7 100644 --- a/modules/item_transfer/exporter.lua +++ b/modules/item_transfer/exporter.lua @@ -52,15 +52,15 @@ item_transfer.register_io_device("exporter", { connect_sides = { "left" }, recipe = { { 1, { - {"", "basic_materials:ic", "default:steel_ingot" }, + {"", "basic_materials:ic", iron_ingot_ingredient }, {"", "microexpansion:cable", "group:shovel" }, - {"", "", "default:steel_ingot" }, + {"", "", iron_ingot_ingredient }, }, }, { 1, { - {"", "microexpansion:logic_chip", "default:steel_ingot" }, + {"", "microexpansion:logic_chip", iron_ingot_ingredient }, {"", "microexpansion:cable", "group:shovel" }, - {"", "", "default:steel_ingot" }, + {"", "", iron_ingot_ingredient }, }, } }, diff --git a/modules/item_transfer/importer.lua b/modules/item_transfer/importer.lua index 52ac2e6..b1352e5 100644 --- a/modules/item_transfer/importer.lua +++ b/modules/item_transfer/importer.lua @@ -59,15 +59,15 @@ item_transfer.register_io_device("importer", { connect_sides = { "left" }, recipe = { { 1, { - {"", "basic_materials:ic", "default:steel_ingot" }, + {"", "basic_materials:ic", iron_ingot_ingredient }, {"", "microexpansion:cable", "group:hoe" }, - {"", "", "default:steel_ingot" }, + {"", "", iron_ingot_ingredient }, }, }, { 1, { - {"", "microexpansion:logic_chip", "default:steel_ingot" }, + {"", "microexpansion:logic_chip", iron_ingot_ingredient }, {"", "microexpansion:cable", "group:hoe" }, - {"", "", "default:steel_ingot" }, + {"", "", iron_ingot_ingredient }, }, } }, diff --git a/modules/item_transfer/init.lua b/modules/item_transfer/init.lua index 6387ba5..0006bc1 100644 --- a/modules/item_transfer/init.lua +++ b/modules/item_transfer/init.lua @@ -4,6 +4,15 @@ local module_path = microexpansion.get_module_path("item_transfer") microexpansion.require_module("network") + +-- Iron Ingot Ingredient for MineClone2 +iron_ingot_ingredient = nil +if minetest.get_modpath("mcl_core") then + iron_ingot_ingredient = "mcl_core:iron_ingot" +else + iron_ingot_ingredient = "default:steel_ingot" +end + -- Load API dofile(module_path.."/api.lua") diff --git a/modules/item_transfer/upgrades.lua b/modules/item_transfer/upgrades.lua index 0b65297..72da6d4 100644 --- a/modules/item_transfer/upgrades.lua +++ b/modules/item_transfer/upgrades.lua @@ -11,7 +11,7 @@ me.register_item("upgrade_base", { recipe = { { 1, { { "microexpansion:quartz_crystal" }, - { "default:steel_ingot" }, + { iron_ingot_ingredient }, }, }, }, diff --git a/modules/network/ctrl.lua b/modules/network/ctrl.lua index 3d0103a..cd3c48f 100644 --- a/modules/network/ctrl.lua +++ b/modules/network/ctrl.lua @@ -4,6 +4,29 @@ local me = microexpansion local network = me.network local access_level = microexpansion.constants.security.access_levels +local ctrl_recipe = nil +if minetest.get_modpath("mcl_core") then + ctrl_recipe = { + { 1, { + {"mcl_core:iron_ingot", "mcl_copper:copper_ingot", "mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "microexpansion:machine_casing", "mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "microexpansion:cable", "mcl_core:iron_ingot"}, + }, + } + } + + +else + ctrl_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"}, + }, + } + } +end + -- [register node] Controller me.register_node("ctrl", { description = "ME Controller", @@ -15,14 +38,7 @@ 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"}, - }, - } - }, + recipe = ctrl_recipe, drawtype = "nodebox", paramtype = "light", node_box = { diff --git a/modules/network/security.lua b/modules/network/security.lua index 850acd6..b3dbf5c 100644 --- a/modules/network/security.lua +++ b/modules/network/security.lua @@ -127,6 +127,28 @@ local function update_security(pos,_,ev) meta:set_string("formspec", security_formspec(pos)) end +local security_recipe = nil +if minetest.get_modpath("mcl_core") then + security_recipe = { + { 1, { + {"mcl_core:iron_ingot", "mcl_copper:copper_ingot", "mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "microexpansion:machine_casing", "mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "microexpansion:cable", "mcl_core:iron_ingot"}, + }, + } + } + +else + security_recipe = { + { 1, { + {"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "microexpansion:machine_casing", "default:steel_ingot"}, + {"default:steel_ingot", "microexpansion:cable", "default:steel_ingot"}, + }, + } + } +end + -- [me chest] Register node microexpansion.register_node("security", { description = "ME Security Terminal", @@ -139,14 +161,7 @@ microexpansion.register_node("security", { "chest_side", "security_front", }, - recipe = { - { 1, { - {"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"}, - {"default:steel_ingot", "microexpansion:machine_casing", "default:steel_ingot"}, - {"default:steel_ingot", "microexpansion:cable", "default:steel_ingot"}, - }, - } - }, + recipe = security_recipe, is_ground_content = false, groups = { cracky = 1, me_connect = 1 }, paramtype = "light", diff --git a/modules/power/gen.lua b/modules/power/gen.lua index d9e6f0d..106e390 100644 --- a/modules/power/gen.lua +++ b/modules/power/gen.lua @@ -1,6 +1,27 @@ -- power/gen.lua local me = microexpansion +local fuel_fired_generator_recipe = nil +if minetest.get_modpath("mcl_core") then +fuel_fired_generator_recipe = { + { 1, { + { "mcl_core:iron_ingot", "mcl_furnaces:furnace", "mcl_core:iron_ingot" }, + { "mcl_core:iron_ingot", "microexpansion:machine_casing", "mcl_core:iron_ingot" }, + { "mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot" }, + }, + } +} + +else +fuel_fired_generator_recipe = { + { 1, { + { "default:steel_ingot", "default:furnace", "default:steel_ingot" }, + {"default:steel_ingot", "microexpansion:machine_casing", "default:steel_ingot" }, + { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, + }, + } +} +end -- [register node] Fuel Fired Generator me.register_machine("fuel_fired_generator", { @@ -14,14 +35,7 @@ me.register_machine("fuel_fired_generator", { "machine_sides", "fuelgen_front", }, - recipe = { - { 1, { - { "default:steel_ingot", "default:furnace", "default:steel_ingot" }, - {"default:steel_ingot", "microexpansion:machine_casing", "default:steel_ingot" }, - { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, - }, - } - }, + recipe = fuel_fired_generator_recipe, groups = { cracky = 1 }, connect_sides = "machine", paramtype2 = "facedir", diff --git a/modules/storage/drive.lua b/modules/storage/drive.lua index 7b23ef5..4ba6e8f 100644 --- a/modules/storage/drive.lua +++ b/modules/storage/drive.lua @@ -268,6 +268,26 @@ local function update_drive(pos,_,ev) end end +if minetest.get_modpath("mcl_core") then + drive_recipe = { + { 1, { + {"mcl_core:iron_ingot", "mcl_chests:chest", "mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "microexpansion:machine_casing", "mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "mcl_chests:chest", "mcl_core:iron_ingot"}, +}, +}} + +else + drive_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" }, + }, + } + } +end + -- [me chest] Register node microexpansion.register_node("drive", { description = "ME Drive", @@ -280,14 +300,7 @@ 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" }, - }, - } - }, + recipe = drive_recipe, 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 3eaa61c..9bfedad 100644 --- a/modules/storage/storage.lua +++ b/modules/storage/storage.lua @@ -2,6 +2,33 @@ --TODO: use storagecomp for crafting +if minetest.get_modpath("mcl_core") then +microexpansion.register_cell("cell_1k", { + description = "1k ME Storage Cell", + capacity = 1000, + recipe = { + { 1, { + {"moreores:tin_ingot", "mcl_copper:copper_ingot", "moreores:tin_ingot"}, + {"mcl_copper:copper_ingot", "microexpansion:steel_infused_obsidian_ingot", "mcl_copper:copper_ingot"}, + {"moreores:tin_ingot", "mcl_copper:copper_ingot", "moreores:tin_ingot"} + }}, + } +}) + +microexpansion.register_cell("cell_2k", { + description = "2k ME Storage Cell", + capacity = 2000, + recipe = { + { 1, { + {"mcl_copper:copper_ingot", "mcl_core:iron_ingot", "mcl_copper:copper_ingot"}, + {"mcl_core:iron_ingot", "mcl_core:obsidian", "mcl_core:iron_ingot"}, + {"mcl_copper:copper_ingot", "mcl_core:iron_ingot", "mcl_copper:copper_ingot"} + }}, + { 1, "shapeless", {"microexpansion:cell_1k", "microexpansion:cell_1k"}} + }, +}) +else + -- [drive] 8k microexpansion.register_cell("cell_1k", { description = "1k ME Storage Cell", @@ -31,6 +58,8 @@ microexpansion.register_cell("cell_2k", { }, }) +end + -- [drive] 16k microexpansion.register_cell("cell_4k", { description = "4k ME Storage Cell", diff --git a/modules/storage/terminal.lua b/modules/storage/terminal.lua index 0bbb343..676f993 100644 --- a/modules/storage/terminal.lua +++ b/modules/storage/terminal.lua @@ -82,6 +82,29 @@ local function update_chest(pos,_,ev) meta:set_string("formspec", chest_formspec(pos, 1, "main", page_max)) end +local term_recipe = nil +if minetest.get_modpath("mcl_core") then +term_recipe = { + { 1, { + {"mcl_core:iron_ingot", "mcl_chests:chest", "mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "microexpansion:machine_casing", "mcl_core:iron_ingot"}, + {"mcl_core:iron_ingot", "microexpansion:cable", "mcl_core:iron_ingot"}, + }, + } +} + +else + +term_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"}, + }, + } + } +end + -- [me chest] Register node microexpansion.register_node("term", { description = "ME Terminal", @@ -94,14 +117,7 @@ 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"}, - }, - } - }, + recipe = term_recipe, is_ground_content = false, groups = { cracky = 1, me_connect = 1, tubedevice = 1, tubedevice_receiver = 1 }, paramtype = "light",