Revert "Fix code errors"

This reverts commit bb76b466b3.
This commit is contained in:
JoseDouglas26 2024-05-26 19:02:09 -03:00
parent bb76b466b3
commit 155fa02cab
1 changed files with 15 additions and 19 deletions

View File

@ -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