From 199a7d8be97b38e2b897168cbcd1ea80e74d31de Mon Sep 17 00:00:00 2001 From: gabriel1379 Date: Sun, 7 Apr 2024 10:27:59 +0200 Subject: [PATCH 1/7] Sort dependency-based entries alphabetically --- technic/machines/register/grinder_recipes.lua | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index f511ef5..f812e76 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -73,13 +73,12 @@ if minetest.get_modpath("everness") then -- Currently (2024-03-09), there seem to be no reverse recipes for any of the other everness sandstones. end -if minetest.get_modpath("farming") then - table.insert(recipes, {"farming:seed_wheat", "farming:flour 1"}) +if minetest.get_modpath("everness") then + table.insert(recipes, {"everness:pyrite_lump", "technic:pyrite_dust 2"}) end -if minetest.get_modpath("moreores") then - table.insert(recipes, {"moreores:mithril_lump", "technic:mithril_dust 2"}) - table.insert(recipes, {"moreores:silver_lump", "technic:silver_dust 2"}) +if minetest.get_modpath("farming") then + table.insert(recipes, {"farming:seed_wheat", "farming:flour 1"}) end if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then @@ -94,8 +93,9 @@ if minetest.get_modpath("homedecor") then table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"}) end -if minetest.get_modpath("everness") then - table.insert(recipes, {"everness:pyrite_lump", "technic:pyrite_dust 2"}) +if minetest.get_modpath("moreores") then + table.insert(recipes, {"moreores:mithril_lump", "technic:mithril_dust 2"}) + table.insert(recipes, {"moreores:silver_lump", "technic:silver_dust 2"}) end for _, data in pairs(recipes) do @@ -139,6 +139,9 @@ register_dust("Sulfur", nil) register_dust("Tin", "default:tin_ingot") register_dust("Wrought Iron", "technic:wrought_iron_ingot") register_dust("Zinc", "technic:zinc_ingot") +if minetest.get_modpath("everness") then + register_dust("Pyrite", "everness:pyrite_ingot") +end if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then register_dust("Akalin", "glooptest:akalin_ingot") register_dust("Alatro", "glooptest:alatro_ingot") @@ -146,9 +149,6 @@ if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then register_dust("Kalite", nil) register_dust("Talinite", "glooptest:talinite_ingot") end -if minetest.get_modpath("everness") then - register_dust("Pyrite", "everness:pyrite_ingot") -end for p = 0, 35 do local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil From b3ca8a591a4b2264f6a8495d77e9a7de28375339 Mon Sep 17 00:00:00 2001 From: gabriel1379 Date: Sun, 7 Apr 2024 12:31:15 +0200 Subject: [PATCH 2/7] feature/add_grinding_recipe_for_nether_lump_and_ingot + image for nether dust --- technic/machines/register/grinder_recipes.lua | 7 +++++++ technic/textures/technic_nether_dust.png | Bin 0 -> 207 bytes 2 files changed, 7 insertions(+) create mode 100644 technic/textures/technic_nether_dust.png diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index f812e76..e3845e6 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -98,6 +98,10 @@ if minetest.get_modpath("moreores") then table.insert(recipes, {"moreores:silver_lump", "technic:silver_dust 2"}) end +if minetest.get_modpath("nether") then + table.insert(recipes, {"nether:nether_lump", "technic:nether_dust 2"}) +end + for _, data in pairs(recipes) do technic.register_grinder_recipe({input = {data[1]}, output = data[2]}) end @@ -149,6 +153,9 @@ if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then register_dust("Kalite", nil) register_dust("Talinite", "glooptest:talinite_ingot") end +if minetest.get_modpath("nether") then + register_dust("Nether", "nether:nether_ingot") +end for p = 0, 35 do local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil diff --git a/technic/textures/technic_nether_dust.png b/technic/textures/technic_nether_dust.png new file mode 100644 index 0000000000000000000000000000000000000000..94a1267821615a041e6b4ff7331b1daa1db45d94 GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`(>z@qLo80e?K#WUuyLYzr+-rTCYo=tv^Um5snKE$TUEML6%v3B874nL;at4Det z Date: Sun, 7 Apr 2024 13:04:26 +0200 Subject: [PATCH 3/7] Refactor dust registration --- technic/machines/register/grinder_recipes.lua | 75 +++++++++++-------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index e3845e6..38aca68 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -106,7 +106,7 @@ for _, data in pairs(recipes) do technic.register_grinder_recipe({input = {data[1]}, output = data[2]}) end --- dusts +-- Dusts local function register_dust(name, ingot) local lname = string.lower(name) lname = string.gsub(lname, ' ', '_') @@ -124,37 +124,50 @@ local function register_dust(name, ingot) end end --- Sorted alphibeticaly -register_dust("Brass", "basic_materials:brass_ingot") -register_dust("Bronze", "default:bronze_ingot") -register_dust("Carbon Steel", "technic:carbon_steel_ingot") -register_dust("Cast Iron", "technic:cast_iron_ingot") -register_dust("Chernobylite", "technic:chernobylite_block") -register_dust("Chromium", "technic:chromium_ingot") -register_dust("Coal", nil) -register_dust("Copper", "default:copper_ingot") -register_dust("Lead", "technic:lead_ingot") -register_dust("Gold", "default:gold_ingot") -register_dust("Mithril", "moreores:mithril_ingot") -register_dust("Silver", "moreores:silver_ingot") -register_dust("Stainless Steel", "technic:stainless_steel_ingot") -register_dust("Stone", "default:stone") -register_dust("Sulfur", nil) -register_dust("Tin", "default:tin_ingot") -register_dust("Wrought Iron", "technic:wrought_iron_ingot") -register_dust("Zinc", "technic:zinc_ingot") -if minetest.get_modpath("everness") then - register_dust("Pyrite", "everness:pyrite_ingot") +-- Sorted alphabetically +local dusts = { + {"Brass", "basic_materials:brass_ingot"}, + {"Bronze", "default:bronze_ingot"}, + {"Carbon Steel", "technic:carbon_steel_ingot"}, + {"Cast Iron", "technic:cast_iron_ingot"}, + {"Chernobylite", "technic:chernobylite_block"}, + {"Chromium", "technic:chromium_ingot"}, + {"Coal", nil}, + {"Copper", "default:copper_ingot"}, + {"Lead", "technic:lead_ingot"}, + {"Gold", "default:gold_ingot"}, + {"Mithril", "moreores:mithril_ingot"}, + {"Silver", "moreores:silver_ingot"}, + {"Stainless Steel", "technic:stainless_steel_ingot"}, + {"Stone", "default:stone"}, + {"Sulfur", nil}, + {"Tin", "default:tin_ingot"}, + {"Wrought Iron", "technic:wrought_iron_ingot"}, + {"Zinc", "technic:zinc_ingot"}, +} + +local dependent_dusts = { + everness = {{"Pyrite", "everness:pyrite_ingot"}}, + gloopores = { + {"Akalin", "glooptest:akalin_ingot"}, + {"Alatro", "glooptest:alatro_ingot"}, + {"Arol", "glooptest:arol_ingot"}, + {"Kalite", nil}, + {"Talinite", "glooptest:talinite_ingot"}, + }, + nether = {{"Nether", "nether:nether_ingot"}}, +} + +for dependency, dusts_to_add in pairs(dependent_dusts) do + if minetest.get_modpath(dependency) then + for _, dust_entry in pairs(dusts_to_add) do + table.insert(dusts, dust_entry) + end + end end -if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then - register_dust("Akalin", "glooptest:akalin_ingot") - register_dust("Alatro", "glooptest:alatro_ingot") - register_dust("Arol", "glooptest:arol_ingot") - register_dust("Kalite", nil) - register_dust("Talinite", "glooptest:talinite_ingot") -end -if minetest.get_modpath("nether") then - register_dust("Nether", "nether:nether_ingot") + +for _, data in ipairs(dusts) do + register_dust(data[1], data[2]) end for p = 0, 35 do From ed9ec6d9bc8a502dd463cc5ffd88e60389b3dc90 Mon Sep 17 00:00:00 2001 From: gabriel1379 Date: Sun, 7 Apr 2024 13:31:10 +0200 Subject: [PATCH 4/7] Refactor remaining dust registration --- technic/machines/register/grinder_recipes.lua | 108 +++++++++--------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index 38aca68..7460627 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -36,73 +36,69 @@ local recipes = { {"default:ice", "default:snowblock"}, } -if minetest.get_modpath("everness") then - table.insert(recipes, {"everness:coral_deep_ocean_sandstone_block", "everness:coral_deep_ocean_sand 2"}) - table.insert(recipes, {"everness:coral_sandstone", "everness:coral_sand 2"}) - table.insert(recipes, {"everness:coral_white_sandstone", "everness:coral_white_sand 2"}) - table.insert(recipes, {"everness:crystal_forest_deep_ocean_sandstone_block", "everness:crystal_forest_deep_ocean_sand 2"}) - table.insert(recipes, {"everness:crystal_sandstone", "everness:crystal_sand 2"}) - table.insert(recipes, {"everness:cursed_lands_deep_ocean_sandstone_block", "everness:cursed_lands_deep_ocean_sand 2"}) - table.insert(recipes, {"everness:cursed_sandstone_block", "everness:cursed_sand 2"}) - table.insert(recipes, {"everness:mineral_sandstone", "everness:mineral_sand 2"}) +local dependent_recipes = { + everness = { + -- Sandstones + {"everness:coral_deep_ocean_sandstone_block", "everness:coral_deep_ocean_sand 2"}, + {"everness:coral_sandstone", "everness:coral_sand 2"}, + {"everness:coral_white_sandstone", "everness:coral_white_sand 2"}, + {"everness:crystal_forest_deep_ocean_sandstone_block", "everness:crystal_forest_deep_ocean_sand 2"}, + {"everness:crystal_sandstone", "everness:crystal_sand 2"}, + {"everness:cursed_lands_deep_ocean_sandstone_block", "everness:cursed_lands_deep_ocean_sand 2"}, + {"everness:cursed_sandstone_block", "everness:cursed_sand 2"}, + {"everness:mineral_sandstone", "everness:mineral_sand 2"}, + -- Lumps and wheat + {"everness:pyrite_lump", "technic:pyrite_dust 2"}, + }, + farming = { + {"farming:seed_wheat", "farming:flour 1"}, + }, + gloopores = { + {"gloopores:alatro_lump", "technic:alatro_dust 2"}, + {"gloopores:kalite_lump", "technic:kalite_dust 2"}, + {"gloopores:arol_lump", "technic:arol_dust 2"}, + {"gloopores:talinite_lump", "technic:talinite_dust 2"}, + {"gloopores:akalin_lump", "technic:akalin_dust 2"}, + }, + homedecor = { + {"home_decor:brass_ingot", "technic:brass_dust 1"}, + }, + moreores = { + {"moreores:mithril_lump", "technic:mithril_dust 2"}, + {"moreores:silver_lump", "technic:silver_dust 2"}, + }, + nether = { + {"nether:nether_lump", "technic:nether_dust 2"}, + }, +} + +for dependency, materials_to_add in pairs(dependent_recipes) do + if minetest.get_modpath(dependency) then + for _, material_entry in pairs(materials_to_add) do + table.insert(recipes, material_entry) + end + end end -- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe) minetest.clear_craft({ - recipe = { - {"default:sandstone"} - }, + recipe = {{"default:sandstone"}}, }) minetest.clear_craft({ - recipe = { - {"default:desert_sandstone"} - }, + recipe = {{"default:desert_sandstone"}}, }) minetest.clear_craft({ - recipe = { - {"default:silver_sandstone"} - }, + recipe = {{"default:silver_sandstone"}}, }) if minetest.get_modpath("everness") then minetest.clear_craft({ - recipe = { - {"everness:mineral_sandstone"} - }, + recipe = {{"everness:mineral_sandstone"}}, }) -- Currently (2024-03-09), there seem to be no reverse recipes for any of the other everness sandstones. end -if minetest.get_modpath("everness") then - table.insert(recipes, {"everness:pyrite_lump", "technic:pyrite_dust 2"}) -end - -if minetest.get_modpath("farming") then - table.insert(recipes, {"farming:seed_wheat", "farming:flour 1"}) -end - -if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then - table.insert(recipes, {"gloopores:alatro_lump", "technic:alatro_dust 2"}) - table.insert(recipes, {"gloopores:kalite_lump", "technic:kalite_dust 2"}) - table.insert(recipes, {"gloopores:arol_lump", "technic:arol_dust 2"}) - table.insert(recipes, {"gloopores:talinite_lump", "technic:talinite_dust 2"}) - table.insert(recipes, {"gloopores:akalin_lump", "technic:akalin_dust 2"}) -end - -if minetest.get_modpath("homedecor") then - table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"}) -end - -if minetest.get_modpath("moreores") then - table.insert(recipes, {"moreores:mithril_lump", "technic:mithril_dust 2"}) - table.insert(recipes, {"moreores:silver_lump", "technic:silver_dust 2"}) -end - -if minetest.get_modpath("nether") then - table.insert(recipes, {"nether:nether_lump", "technic:nether_dust 2"}) -end - -for _, data in pairs(recipes) do +for _, data in ipairs(recipes) do technic.register_grinder_recipe({input = {data[1]}, output = data[2]}) end @@ -147,7 +143,9 @@ local dusts = { } local dependent_dusts = { - everness = {{"Pyrite", "everness:pyrite_ingot"}}, + everness = { + {"Pyrite", "everness:pyrite_ingot"}, + }, gloopores = { {"Akalin", "glooptest:akalin_ingot"}, {"Alatro", "glooptest:alatro_ingot"}, @@ -155,7 +153,9 @@ local dependent_dusts = { {"Kalite", nil}, {"Talinite", "glooptest:talinite_ingot"}, }, - nether = {{"Nether", "nether:nether_ingot"}}, + nether = { + {"Nether", "nether:nether_ingot"}, + }, } for dependency, dusts_to_add in pairs(dependent_dusts) do @@ -170,6 +170,7 @@ for _, data in ipairs(dusts) do register_dust(data[1], data[2]) end +-- Uranium for p = 0, 35 do local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil local psuffix = p == 7 and "" or p @@ -205,6 +206,7 @@ for pa = 0, 34 do end end +-- Fuels minetest.register_craft({ type = "fuel", recipe = "technic:coal_dust", From 0bf4066d2b7b3a0346d6265130b7e368bab8678b Mon Sep 17 00:00:00 2001 From: gabriel1379 Date: Sun, 7 Apr 2024 13:42:08 +0200 Subject: [PATCH 5/7] Adjust comment and use ipairs instead of pairs for non-keyed table --- technic/machines/register/grinder_recipes.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index 7460627..c0e5540 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -37,8 +37,8 @@ local recipes = { } local dependent_recipes = { - everness = { -- Sandstones + everness = { {"everness:coral_deep_ocean_sandstone_block", "everness:coral_deep_ocean_sand 2"}, {"everness:coral_sandstone", "everness:coral_sand 2"}, {"everness:coral_white_sandstone", "everness:coral_white_sand 2"}, @@ -74,7 +74,7 @@ local dependent_recipes = { for dependency, materials_to_add in pairs(dependent_recipes) do if minetest.get_modpath(dependency) then - for _, material_entry in pairs(materials_to_add) do + for _, material_entry in ipairs(materials_to_add) do table.insert(recipes, material_entry) end end From fd34254c9c394100547a8704324ca4eb4d87ae3e Mon Sep 17 00:00:00 2001 From: gabriel1379 Date: Sat, 13 Apr 2024 21:23:19 +0200 Subject: [PATCH 6/7] Add additional check for nether (to make sure that we have the right one) --- technic/machines/register/grinder_recipes.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index c0e5540..493227e 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -8,6 +8,18 @@ function technic.register_grinder_recipe(data) technic.register_recipe("grinding", data) end +-- Function for cases where multiple mods exist with the same name, +-- to check if we have the right one. +local function is_right_mod(dependency) + local is_right = true + + if dependency == "nether" then + is_right = minetest.registered_nodes["nether:brick_compressed"] ~= nil + end + + return is_right +end + local recipes = { -- Dusts {"default:coal_lump", "technic:coal_dust 2"}, @@ -73,7 +85,7 @@ local dependent_recipes = { } for dependency, materials_to_add in pairs(dependent_recipes) do - if minetest.get_modpath(dependency) then + if minetest.get_modpath(dependency) and is_right_mod(dependency) then for _, material_entry in ipairs(materials_to_add) do table.insert(recipes, material_entry) end @@ -159,7 +171,7 @@ local dependent_dusts = { } for dependency, dusts_to_add in pairs(dependent_dusts) do - if minetest.get_modpath(dependency) then + if minetest.get_modpath(dependency) and is_right_mod(dependency) then for _, dust_entry in pairs(dusts_to_add) do table.insert(dusts, dust_entry) end From a2b213c8602fa186f83ad6bd4ebaca41c88573e2 Mon Sep 17 00:00:00 2001 From: gabriel1379 Date: Fri, 19 Apr 2024 07:25:12 +0200 Subject: [PATCH 7/7] Revert "Add additional check for nether (to make sure that we have the right one)" This reverts commit fd34254c9c394100547a8704324ca4eb4d87ae3e. --- technic/machines/register/grinder_recipes.lua | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index 493227e..c0e5540 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -8,18 +8,6 @@ function technic.register_grinder_recipe(data) technic.register_recipe("grinding", data) end --- Function for cases where multiple mods exist with the same name, --- to check if we have the right one. -local function is_right_mod(dependency) - local is_right = true - - if dependency == "nether" then - is_right = minetest.registered_nodes["nether:brick_compressed"] ~= nil - end - - return is_right -end - local recipes = { -- Dusts {"default:coal_lump", "technic:coal_dust 2"}, @@ -85,7 +73,7 @@ local dependent_recipes = { } for dependency, materials_to_add in pairs(dependent_recipes) do - if minetest.get_modpath(dependency) and is_right_mod(dependency) then + if minetest.get_modpath(dependency) then for _, material_entry in ipairs(materials_to_add) do table.insert(recipes, material_entry) end @@ -171,7 +159,7 @@ local dependent_dusts = { } for dependency, dusts_to_add in pairs(dependent_dusts) do - if minetest.get_modpath(dependency) and is_right_mod(dependency) then + if minetest.get_modpath(dependency) then for _, dust_entry in pairs(dusts_to_add) do table.insert(dusts, dust_entry) end