From 98675a2ae9a80206a4ab8e24f4cf698ec11d3625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1briel?= <38207624+gabriel1379@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:44:51 +0200 Subject: [PATCH] Add compressor recipes for nether brick and lump (#639) Another addition with nether, similar to the previous one, just this time for compressor. Clears nether's default recipes for compressed nether brick and nether lump, using the compressor instead for these tasks. --- .../machines/register/compressor_recipes.lua | 117 ++++++++++++------ technic/mod.conf | 2 +- 2 files changed, 80 insertions(+), 39 deletions(-) diff --git a/technic/machines/register/compressor_recipes.lua b/technic/machines/register/compressor_recipes.lua index ad09868..6acee20 100644 --- a/technic/machines/register/compressor_recipes.lua +++ b/technic/machines/register/compressor_recipes.lua @@ -8,6 +8,70 @@ function technic.register_compressor_recipe(data) technic.register_recipe("compressing", data) end +-- Defuse the default recipes, since we have +-- the compressor to take over in a more realistic manner. +local crafts_to_clear = { + "default:desert_sand", + "default:sand", + "default:silver_sand", +} + +local dependent_crafts_to_clear = { + everness = { + "everness:coral_sand", + "everness:coral_forest_deep_ocean_sand", + "everness:coral_white_sand", + "everness:crystal_sand", + "everness:cursed_sand", + "everness:cursed_lands_deep_ocean_sand", + "everness:crystal_forest_deep_ocean_sand", + "everness:mineral_sand", + }, + nether = { + "nether:brick", + "nether:brick_compressed", + }, +} + +-- Add dependent recipes to main collection of +-- recipes to be cleared if their mods are used. +for dependency, crafts in pairs(dependent_crafts_to_clear) do + if minetest.get_modpath(dependency) then + for _, craft_entry in ipairs(crafts) do + table.insert(crafts_to_clear, craft_entry) + end + end +end + +-- Clear recipes +for _, craft_name in ipairs(crafts_to_clear) do + local is_regular = string.sub(craft_name, 1, 7) ~= "nether:" + local shaped_recipe + + if is_regular then + -- Regular compression recipes use 2x2 shape. + shaped_recipe = { + {craft_name, craft_name}, + {craft_name, craft_name}, + } + else + -- Nether's compression recipes use 3x3 shape. + shaped_recipe = { + {craft_name, craft_name, craft_name}, + {craft_name, craft_name, craft_name}, + {craft_name, craft_name, craft_name}, + } + end + + minetest.clear_craft({ + type = "shaped", + recipe = shaped_recipe, + }) +end + +-- +-- Compile compressor recipes +-- local recipes = { {"default:snowblock", "default:ice"}, {"default:sand 2", "default:sandstone"}, @@ -21,8 +85,8 @@ local recipes = { {"technic:uranium35_ingot 5", "technic:uranium_fuel"}, } -if minetest.get_modpath("everness") then - local everness_sand_to_sandstone_recipes = { +local dependent_recipes = { + everness = { {"everness:coral_deep_ocean_sand 2", "everness:coral_deep_ocean_sandstone_block"}, {"everness:coral_sand 2", "everness:coral_sandstone"}, {"everness:coral_white_sand 2", "everness:coral_white_sandstone"}, @@ -31,47 +95,24 @@ if minetest.get_modpath("everness") then {"everness:cursed_lands_deep_ocean_sand 2", "everness:cursed_lands_deep_ocean_sandstone_block"}, {"everness:cursed_sand 2", "everness:cursed_sandstone_block"}, {"everness:mineral_sand 2", "everness:mineral_sandstone"}, - } - - for _, data in ipairs(everness_sand_to_sandstone_recipes) do - table.insert(recipes, {data[1], data[2]}) - end -end - --- defuse the default sandstone recipe, since we have the compressor to take over in a more realistic manner -local crafts_to_clear = { - "default:desert_sand", - "default:sand", - "default:silver_sand" + }, + nether = { + {"nether:brick 9", "nether:brick_compressed"}, + {"nether:brick_compressed 9", "nether:nether_lump"}, + }, } -if minetest.get_modpath("everness") then - local everness_crafts_to_clear = { - "everness:coral_sand", - "everness:coral_forest_deep_ocean_sand", - "everness:coral_white_sand", - "everness:crystal_sand", - "everness:cursed_sand", - "everness:cursed_lands_deep_ocean_sand", - "everness:crystal_forest_deep_ocean_sand", - "everness:mineral_sand", - } - - for _, sand_name in ipairs(everness_crafts_to_clear) do - table.insert(crafts_to_clear, sand_name) +-- Add dependent recipes to main recipe collection +-- if their mods are used. +for dependency, recipes_to_add in pairs(dependent_recipes) do + if minetest.get_modpath(dependency) then + for _, recipe_entry in ipairs(recipes_to_add) do + table.insert(recipes, recipe_entry) + end end end -for _, sand_name in ipairs(crafts_to_clear) do - minetest.clear_craft({ - type = "shaped", - recipe = { - {sand_name, sand_name}, - {sand_name, sand_name}, - }, - }) -end - +-- Register compressor recipes for _, data in pairs(recipes) do technic.register_compressor_recipe({input = {data[1]}, output = data[2]}) end diff --git a/technic/mod.conf b/technic/mod.conf index 71062ab..97ca806 100644 --- a/technic/mod.conf +++ b/technic/mod.conf @@ -1,3 +1,3 @@ name = technic depends = default, pipeworks, technic_worldgen, basic_materials -optional_depends = bucket, screwdriver, mesecons, mesecons_mvps, digilines, digiline_remote, intllib, unified_inventory, vector_extras, dye, craftguide, i3, everness +optional_depends = bucket, screwdriver, mesecons, mesecons_mvps, digilines, digiline_remote, intllib, unified_inventory, vector_extras, dye, craftguide, i3, everness, nether