forked from VoxeLibre/VoxeLibre
Comments and corrections
This commit is contained in:
parent
1da49026ab
commit
6c84848bce
|
@ -32,7 +32,6 @@ local function get_shape(name, material)
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- This function is responsible for recording the recipes for each block (including oxidized variants).
|
--- 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 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
|
--- If the main material is another block (as in the case of the chiseled copper block), the material
|
||||||
|
@ -72,10 +71,8 @@ local function register_variants_recipes(name, material, amount)
|
||||||
else
|
else
|
||||||
materials = material
|
materials = material
|
||||||
end
|
end
|
||||||
--[[
|
-- Registering each recipe according to the materials blocks made from copper and its oxidized and
|
||||||
Registering each recipe according to the materials
|
-- waxed variations.
|
||||||
blocks made from copper and its oxidized and waxed variations).
|
|
||||||
]]
|
|
||||||
for i = 1, 8 do
|
for i = 1, 8 do
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_copper:"..names[i].." "..tostring(amount),
|
output = "mcl_copper:"..names[i].." "..tostring(amount),
|
||||||
|
@ -85,7 +82,9 @@ local function register_variants_recipes(name, material, amount)
|
||||||
end
|
end
|
||||||
-- Using the function above to record the recipes for cut copper blocks, copper grates and copper bulbs.
|
-- Using the function above to record the recipes for cut copper blocks, copper grates and copper bulbs.
|
||||||
register_variants_recipes("cut", "block", 4)
|
register_variants_recipes("cut", "block", 4)
|
||||||
|
|
||||||
register_variants_recipes("grate", "block", 4)
|
register_variants_recipes("grate", "block", 4)
|
||||||
|
|
||||||
register_variants_recipes("bulb_off", "block", 4)
|
register_variants_recipes("bulb_off", "block", 4)
|
||||||
-- Chiseled copper uses slabs as the main material.
|
-- Chiseled copper uses slabs as the main material.
|
||||||
local chiseled_materials = {
|
local chiseled_materials = {
|
||||||
|
|
|
@ -52,12 +52,13 @@ local function register_oxidation_and_scraping(mod_name, subname, decay_chain)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Function used to define the waxed and stripped variants (for the waxed variants) of copper-related
|
--- 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).
|
--- 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
|
--- "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
|
--- 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).
|
--- 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 function register_waxing_and_scraping(mod_name, subname, decay_chain)
|
||||||
local waxed_item, unwaxed_item
|
local waxed_item, unwaxed_item
|
||||||
|
|
||||||
for i = 1, #decay_chain do
|
for i = 1, #decay_chain do
|
||||||
|
@ -119,10 +120,17 @@ local doors_decay_chain = {
|
||||||
}
|
}
|
||||||
-- Defining variants for copper-related blocks that are registered by external APIs.
|
-- 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", "stair_copper", cut_decay_chain)
|
||||||
|
|
||||||
register_oxidation_and_scraping("mcl_stairs", "slab_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", "trapdoor", doors_decay_chain)
|
||||||
|
|
||||||
register_oxidation_and_scraping("mcl_copper", "door", 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", "stair_waxed_copper", cut_decay_chain)
|
||||||
|
|
||||||
register_waxing_and_scraping("mcl_stairs", "slab_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_trapdoor", doors_decay_chain)
|
||||||
|
|
||||||
register_waxing_and_scraping("mcl_copper", "waxed_door", doors_decay_chain)
|
register_waxing_and_scraping("mcl_copper", "waxed_door", doors_decay_chain)
|
||||||
|
|
|
@ -10,8 +10,6 @@ dofile(path .. "/nodes.lua")
|
||||||
dofile(path .. "/items.lua")
|
dofile(path .. "/items.lua")
|
||||||
-- Loading the file that registers the blocks crafting recipes
|
-- Loading the file that registers the blocks crafting recipes
|
||||||
dofile(path .. "/crafting.lua")
|
dofile(path .. "/crafting.lua")
|
||||||
--[[
|
-- Loading the file that handles oxidized, waxed and stripped variants for blocks that are registered
|
||||||
Loading the file that handles oxidized, waxed and stripped variants for blocks that are registered
|
-- in other mods and normally do not have these variants.
|
||||||
in other mods and normally do not have these variants.
|
|
||||||
]]
|
|
||||||
dofile(path .. "/functions.lua")
|
dofile(path .. "/functions.lua")
|
||||||
|
|
|
@ -16,7 +16,14 @@ local function set_drop(drop, old_name, index_name)
|
||||||
|
|
||||||
return drop
|
return drop
|
||||||
end
|
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.
|
||||||
|
--- Doors and trapdoors they will be part of groups related to mesecon, indicating that mesecon
|
||||||
|
--- (redstone) has an effect on them.
|
||||||
|
---@param name string
|
||||||
|
---@param groups table
|
||||||
|
---@return table|nil
|
||||||
local function set_groups(name, groups)
|
local function set_groups(name, groups)
|
||||||
local groups = table.copy(groups)
|
local groups = table.copy(groups)
|
||||||
|
|
||||||
|
@ -52,7 +59,7 @@ local function set_light_level(light_source, index)
|
||||||
|
|
||||||
return light_source
|
return light_source
|
||||||
end
|
end
|
||||||
--- Function used to set tiles for blocks. "tiles" must be a table with 4 values as the waxed variants
|
--- 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,
|
--- 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).
|
--- twice the number of textures in the table (8 as the maximum value).
|
||||||
---@param tiles table
|
---@param tiles table
|
||||||
|
@ -109,24 +116,18 @@ local function register_copper_variants(name, definitions)
|
||||||
end
|
end
|
||||||
-- Registering the 8 nodes in the oxidation chain.
|
-- Registering the 8 nodes in the oxidation chain.
|
||||||
for i = 1, #names do
|
for i = 1, #names do
|
||||||
--[[
|
-- Defining whether the block is waxed and defining its stripped variant (its non-oxidized
|
||||||
Defining whether the block is waxed and defining its stripped variant (its non-oxidized
|
-- variant, which must precede the waxed variant in the name table).
|
||||||
variant, which must precede the waxed variant in the name table).
|
|
||||||
]]
|
|
||||||
if names[i]:find("waxed") then
|
if names[i]:find("waxed") then
|
||||||
stripped_variant = "mcl_copper:"..names[i-1]
|
stripped_variant = "mcl_copper:"..names[i-1]
|
||||||
else
|
else
|
||||||
--[[
|
-- While the "oxidized" variant is not found, this snippet defines the oxidized variant of
|
||||||
While the "oxidized" variant is not found, this snippet defines the oxidized variant of
|
-- the block.
|
||||||
the block.
|
|
||||||
]]
|
|
||||||
if not names[i]:find("oxidized") then
|
if not names[i]:find("oxidized") then
|
||||||
oxidized_variant = "mcl_copper:"..names[i+2]
|
oxidized_variant = "mcl_copper:"..names[i+2]
|
||||||
end
|
end
|
||||||
--[[
|
-- Defining the stripped variant with the exception of the first block in the chain
|
||||||
Defining the stripped variant with the exception of the first block in the chain
|
-- (and the waxed ones that were defined before).
|
||||||
(and the waxed ones that were defined before).
|
|
||||||
]]
|
|
||||||
if i ~= 1 then
|
if i ~= 1 then
|
||||||
stripped_variant = "mcl_copper:"..names[i-2]
|
stripped_variant = "mcl_copper:"..names[i-2]
|
||||||
end
|
end
|
||||||
|
@ -176,14 +177,12 @@ local function register_copper_variants(name, definitions)
|
||||||
-- Defining the special groups for doors and trapdoors.
|
-- Defining the special groups for doors and trapdoors.
|
||||||
local door_groups = set_groups(names[i]:gsub(name, "door"), definitions.groups)
|
local door_groups = set_groups(names[i]:gsub(name, "door"), definitions.groups)
|
||||||
local trapdoor_groups = set_groups(names[i]:gsub(name, "trapdoor"), definitions.groups)
|
local trapdoor_groups = set_groups(names[i]:gsub(name, "trapdoor"), definitions.groups)
|
||||||
--[[
|
-- Managing the textures related to doors and trapdoors, as well as the texture of the item
|
||||||
Managing the textures related to doors and trapdoors, as well as the texture of the item
|
-- for each door. As with the other blocks, the waxed variant uses the same textures as the
|
||||||
for each door. As with the other blocks, the waxed variant uses the same textures as the
|
-- unwaxed variants.
|
||||||
unwaxed variants.
|
-- itemimg -> item image for the doors on inventory;
|
||||||
itemimg -> item image for the doors on inventory;
|
-- lowertext / uppertext -> lower and bottom textures for the doors;
|
||||||
lowertext / uppertext -> lower and bottom textures for the doors;
|
-- frontimg / sideimg -> front and side textures for the trapdoors;
|
||||||
frontimg / sideimg -> front and side textures for the trapdoors;
|
|
||||||
]]
|
|
||||||
if i % 2 == 1 then
|
if i % 2 == 1 then
|
||||||
itemimg = "mcl_copper_item_"..names[i]:gsub(name, "door")..".png"
|
itemimg = "mcl_copper_item_"..names[i]:gsub(name, "door")..".png"
|
||||||
lowertext = "mcl_copper_"..names[i]:gsub(name, "door").."_lower.png"
|
lowertext = "mcl_copper_"..names[i]:gsub(name, "door").."_lower.png"
|
||||||
|
@ -231,10 +230,8 @@ end
|
||||||
-- Using the function above to register the copper blocks.
|
-- Using the function above to register the copper blocks.
|
||||||
register_copper_variants("block", {
|
register_copper_variants("block", {
|
||||||
groups = {pickaxey = 2, building_block = 1},
|
groups = {pickaxey = 2, building_block = 1},
|
||||||
--[[
|
-- Copper blocks are no longer the manufacturing material for doors but this definition will be
|
||||||
Copper blocks are no longer the manufacturing material for doors but this definition will be
|
-- maintained here to avoid individual registration of 16 blocks.
|
||||||
maintained here to avoid individual registration of 16 blocks.
|
|
||||||
]]
|
|
||||||
_mcl_doors = true,
|
_mcl_doors = true,
|
||||||
})
|
})
|
||||||
-- Using the function above to register the cut copper blocks.
|
-- Using the function above to register the cut copper blocks.
|
||||||
|
|
Loading…
Reference in New Issue