More changes on comments and on mcl_honey

This commit is contained in:
JoseDouglas26 2024-05-07 11:01:31 -03:00
parent 6c84848bce
commit ba5c0a7f74
4 changed files with 23 additions and 19 deletions

View File

@ -32,6 +32,7 @@ local function get_shape(name, material)
return {}
end
end
--- This function is responsible for recording the recipes for each block (including oxidized variants).
--- If the recipe's main material is the Block of Copper, the material parameter must be passed as "block".
--- If the main material is another block (as in the case of the chiseled copper block), the material

View File

@ -104,33 +104,30 @@ local function 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 = {
local decay_chain = {
"",
"_exposed",
"_weathered",
"_oxidized"
}
-- Defining variants for copper-related blocks that are registered by external APIs.
register_oxidation_and_scraping("mcl_stairs", "stair_copper", cut_decay_chain)
-- Defining variants for doors and trapdoors.
register_oxidation_and_scraping("mcl_copper", "trapdoor", decay_chain)
register_oxidation_and_scraping("mcl_stairs", "slab_copper", cut_decay_chain)
register_oxidation_and_scraping("mcl_copper", "door", decay_chain)
register_oxidation_and_scraping("mcl_copper", "trapdoor", doors_decay_chain)
register_waxing_and_scraping("mcl_copper", "waxed_trapdoor", decay_chain)
register_oxidation_and_scraping("mcl_copper", "door", doors_decay_chain)
register_waxing_and_scraping("mcl_copper", "waxed_door", decay_chain)
-- Redefining values and using decay chains for stairs and slabs.
for i = 1, 4 do
decay_chain[i] = decay_chain[i].."_cut"
end
-- Defining variants for stairs and slabs.
register_oxidation_and_scraping("mcl_stairs", "stair_copper", decay_chain)
register_waxing_and_scraping("mcl_stairs", "stair_waxed_copper", cut_decay_chain)
register_oxidation_and_scraping("mcl_stairs", "slab_copper", decay_chain)
register_waxing_and_scraping("mcl_stairs", "slab_waxed_copper", cut_decay_chain)
register_waxing_and_scraping("mcl_stairs", "stair_waxed_copper", decay_chain)
register_waxing_and_scraping("mcl_copper", "waxed_trapdoor", doors_decay_chain)
register_waxing_and_scraping("mcl_copper", "waxed_door", doors_decay_chain)
register_waxing_and_scraping("mcl_stairs", "slab_waxed_copper", decay_chain)

View File

@ -1,4 +1,5 @@
local S = minetest.get_translator("mcl_copper")
--- Function to set drop (only useful for copper bulbs that are not available in the creative inventory).
--- To have a special drop, the block definition must contain the "drop" parameter.
--- "old_name" must be a string containing the name of the node that will receive the special drop
@ -16,6 +17,7 @@ local function set_drop(drop, old_name, index_name)
return drop
end
--- Function used to set special groups for some blocks based on its names.
--- "oxidizable" is the group that indicates that the block can oxidize.
--- "waxed" is the group that indicates that the block can not oxidize.
@ -44,6 +46,7 @@ local function set_groups(name, groups)
return groups
end
--- Function to set the light level for copper bulbs. Calculated based on the index passed to the function.
--- "light_source" must be a integer which is the maximum desired light level. "index" must be a integer
--- as well. "index" is used to define the level of oxidation of the bulb, as the light level decreases
@ -59,6 +62,7 @@ local function set_light_level(light_source, index)
return light_source
end
--- Function used to set tiles for blocks. "tiles" must be a table with 4 values as waxed variants
--- use the same textures as the unwaxed versions. "index" must be an integer that must be, at most,
--- twice the number of textures in the table (8 as the maximum value).
@ -72,6 +76,7 @@ local function set_tiles(tiles, index)
return tiles[math.ceil(index / 2)]
end
--- Function used to register all blocks on the oxidation chain, including the waxed variants for each
--- block. It also registers some special blocks like doors, trapdoors, slabs and stairs. "name" should
--- be a string containing the subname of the block. "definitions" must be a table that contains only
@ -243,6 +248,7 @@ register_copper_variants("cut", {
register_copper_variants("grate", {
drawtype = "allfaces",
groups = {pickaxey = 2, building_block = 1, disable_suffocation = 1},
paramtype = "light",
sunlight_propagates = true,
})
--[[

View File

@ -15,7 +15,7 @@ function mcl_honey.wax_block(pos, node, player, itemstack, pointed_thing)
end
local def = minetest.registered_nodes[node.name]
if player:get_player_control().sneak then
if player and player:get_player_control().sneak then
if def and def._mcl_waxed_variant then
if def.groups.door == 1 then
if node.name:find("_b_") then