From 155fa02caba2fb5acbee16b4d28e6cbc2ef64bf5 Mon Sep 17 00:00:00 2001 From: JoseDouglas26 Date: Sun, 26 May 2024 19:02:09 -0300 Subject: [PATCH] Revert "Fix code errors" This reverts commit bb76b466b33c573628cc53ef959f6ccd5ff17ec8. --- mods/ITEMS/mcl_copper/functions.lua | 34 +++++++++++++---------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index 95128ccf6..e138a63f4 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -60,6 +60,12 @@ end ---@param decay_chain table local function register_oxidation_and_scraping(mod_name, subname, decay_chain) local item, oxidized_item + -- Handling special decay chain names. + if mod_name == "mcl_stairs" then + for i = 1, 4 do + decay_chain[i] = decay_chain[i].."_cut" + end + end for i = 1, #decay_chain - 1 do item = mod_name..":"..subname..decay_chain[i] @@ -118,12 +124,18 @@ end --- containing the list of subnames of the block oxidation chain (without the waxed variants subnames). local function register_waxing_and_scraping(mod_name, subname, decay_chain) local waxed_item, unwaxed_item + -- Handling special decay chain names. + if mod_name == "mcl_stairs" then + for i = 1, 4 do + decay_chain[i] = decay_chain[i].."_cut" + end + end for i = 1, #decay_chain do waxed_item = mod_name..":"..subname..decay_chain[i] unwaxed_item = mod_name..":"..subname:gsub("waxed_", "")..decay_chain[i] - for _, subnode in pairs(mcl_copper.subnodes[subname:gsub("waxed_", "")]) do + for _, subnode in pairs(mcl_copper.subnodes[subname]) do if subnode == "" then minetest.override_item(waxed_item, {_mcl_stripped_variant = unwaxed_item}) minetest.override_item(unwaxed_item, {_mcl_waxed_variant = waxed_item}) @@ -181,6 +193,8 @@ local mods_and_blocks = { {"mesecons_button", "button_copper", "button_waxed_copper"}, {"mcl_copper", "door", "waxed_door"}, {"mcl_copper", "pressure_plate_copper", "pressure_plate_waxed_copper"}, + {"mcl_stairs", "slab_copper", "slab_waxed_copper"}, + {"mcl_stairs", "stair_copper", "stair_waxed_copper"}, {"mcl_copper", "trapdoor", "waxed_trapdoor"} } -- Defining variants for all blocks registered by other API's. @@ -192,21 +206,3 @@ for _, mod_and_blocks in pairs(mods_and_blocks) do register_oxidation_and_scraping(mod, oxidize_and_scrap, decay_chain) register_waxing_and_scraping(mod, wax_and_scrap, decay_chain) end - -for i = 1, 4 do - decay_chain[i] = decay_chain[i].."_cut" -end - -mods_and_blocks = { - {"mcl_stairs", "slab_copper", "slab_waxed_copper"}, - {"mcl_stairs", "stair_copper", "stair_waxed_copper"} -} - -for _, mod_and_blocks in pairs(mods_and_blocks) do - local mod = mod_and_blocks[1] - local oxidize_and_scrap = mod_and_blocks[2] - local wax_and_scrap = mod_and_blocks[3] - - register_oxidation_and_scraping(mod, oxidize_and_scrap, decay_chain) - register_waxing_and_scraping(mod, wax_and_scrap, decay_chain) -end