Comments and changes on functions.lua

This commit is contained in:
JoseDouglas26 2024-05-05 20:11:54 -03:00
parent fc373c2f47
commit 1da49026ab
1 changed files with 26 additions and 13 deletions

View File

@ -1,4 +1,12 @@
function mcl_copper.register_oxidation_and_scraping(mod_name, subname, decay_chain)
--- Function used to define the oxidized and stripped variants of copper-related blocks that
--- are registered by APIs external to mcl_copper (stairs, slabs, doors and trapdoors). "mod_name"
--- should be the name of the mod the blocks belong to. "subname" must be the subname of the block that
--- will receive the changes (see registered subnames below). "decay_chain" should be a table containing
--- the list of subnames of the block oxidation chain (without the waxed variants subnames).
---@param mod_name string
---@param subname string
---@param decay_chain table
local function register_oxidation_and_scraping(mod_name, subname, decay_chain)
local item, oxidized_item
for i = 1, #decay_chain - 1 do
@ -44,8 +52,12 @@ function mcl_copper.register_oxidation_and_scraping(mod_name, subname, decay_cha
end
end
end
function mcl_copper.register_waxing_and_scraping(mod_name, subname, decay_chain)
--- Function used to define the waxed and stripped variants (for the waxed variants) of copper-related
--- blocks that are registered by APIs external to mcl_copper (stairs, slabs, doors and trapdoors).
--- "mod_name" should be the name of the mod the blocks belong to. "subname" must be the subname of the
--- block that will receive the changes (see registered subnames below). "decay_chain" should be a table
--- containing the list of subnames of the block oxidation chain (without the waxed variants subnames).
function register_waxing_and_scraping(mod_name, subname, decay_chain)
local waxed_item, unwaxed_item
for i = 1, #decay_chain do
@ -91,25 +103,26 @@ function mcl_copper.register_waxing_and_scraping(mod_name, subname, decay_chain)
end
end
end
-- Decay chain for stairs and slabs
local cut_decay_chain = {
"_cut",
"_exposed_cut",
"_weathered_cut",
"_oxidized_cut"
}
-- Decay chain for doors and trapdoors
local doors_decay_chain = {
"",
"_exposed",
"_weathered",
"_oxidized"
}
mcl_copper.register_oxidation_and_scraping("mcl_stairs", "stair_copper", cut_decay_chain)
mcl_copper.register_oxidation_and_scraping("mcl_stairs", "slab_copper", cut_decay_chain)
mcl_copper.register_oxidation_and_scraping("mcl_copper", "trapdoor", doors_decay_chain)
mcl_copper.register_oxidation_and_scraping("mcl_copper", "door", doors_decay_chain)
mcl_copper.register_waxing_and_scraping("mcl_stairs", "stair_waxed_copper", cut_decay_chain)
mcl_copper.register_waxing_and_scraping("mcl_stairs", "slab_waxed_copper", cut_decay_chain)
mcl_copper.register_waxing_and_scraping("mcl_copper", "waxed_trapdoor", doors_decay_chain)
mcl_copper.register_waxing_and_scraping("mcl_copper", "waxed_door", doors_decay_chain)
-- Defining variants for copper-related blocks that are registered by external APIs.
register_oxidation_and_scraping("mcl_stairs", "stair_copper", cut_decay_chain)
register_oxidation_and_scraping("mcl_stairs", "slab_copper", cut_decay_chain)
register_oxidation_and_scraping("mcl_copper", "trapdoor", doors_decay_chain)
register_oxidation_and_scraping("mcl_copper", "door", doors_decay_chain)
register_waxing_and_scraping("mcl_stairs", "stair_waxed_copper", cut_decay_chain)
register_waxing_and_scraping("mcl_stairs", "slab_waxed_copper", cut_decay_chain)
register_waxing_and_scraping("mcl_copper", "waxed_trapdoor", doors_decay_chain)
register_waxing_and_scraping("mcl_copper", "waxed_door", doors_decay_chain)