forked from VoxeLibre/VoxeLibre
New function and comments
This commit is contained in:
parent
0b40c1eb62
commit
48b6619034
|
@ -1,11 +1,16 @@
|
|||
--- This function determines the format of the crafting recipe in the crafting grid based on the
|
||||
--- block name. Each block must have its own crafting format for the given material(s).
|
||||
--- Some materials in the recipe can be pre-defined (e.g. copper bulbs have fixed materials
|
||||
--(blaze stick and redstone) and materials that vary according to the material parameter).
|
||||
--- (blaze stick and redstone) and materials that vary according to the material parameter).
|
||||
--- material can be nil if the recipe uses copper ingots.
|
||||
---@param name string
|
||||
---@param material string
|
||||
---@param material string|nil
|
||||
---@return table
|
||||
local function get_shape(name, material)
|
||||
if not material then
|
||||
material = "mcl_copper:copper_ingot"
|
||||
end
|
||||
|
||||
if name == "cut" then -- Shape of cut copper blocks.
|
||||
return {
|
||||
{material, material},
|
||||
|
@ -28,6 +33,28 @@ local function get_shape(name, material)
|
|||
{material, "mcl_mobitems:blaze_rod", material},
|
||||
{"", "mesecons:redstone", ""}
|
||||
}
|
||||
elseif name == "mcl_copper:door" then
|
||||
return {
|
||||
{material, material},
|
||||
{material, material},
|
||||
{material, material}
|
||||
}
|
||||
elseif name:find("trapdoor") then
|
||||
return {
|
||||
{material, material},
|
||||
{material, material}
|
||||
}
|
||||
elseif name:find("button_copper_off") then
|
||||
return {material}
|
||||
elseif name:find("pressure_plate_copper_off") then
|
||||
return {
|
||||
{material, material}
|
||||
}
|
||||
elseif name:find("bars_copper_flat") then
|
||||
return {
|
||||
{material, material, material},
|
||||
{material, material, material}
|
||||
}
|
||||
else
|
||||
return {}
|
||||
end
|
||||
|
@ -87,6 +114,36 @@ register_variants_recipes("cut", "block", 4)
|
|||
register_variants_recipes("grate", "block", 4)
|
||||
|
||||
register_variants_recipes("bulb_off", "block", 4)
|
||||
|
||||
--- Function used to register recipes that uses copper ingots as material.
|
||||
---@param name string
|
||||
---@param amount integer
|
||||
local function register_ingot_recipes(name, amount)
|
||||
local type = "shaped"
|
||||
|
||||
if name:find("button") then
|
||||
type = "shapeless"
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = name.." "..tostring(amount),
|
||||
recipe = get_shape(name, nil),
|
||||
type = type
|
||||
})
|
||||
end
|
||||
-- Blocks made with copper ingots.
|
||||
local made_of_ingots = {
|
||||
{"xpanes:bars_copper_flat", 16},
|
||||
{"mesecons_button:button_copper_off", 1},
|
||||
{"mcl_copper:door", 3},
|
||||
{"mcl_copper:pressure_plate_copper_off", 1},
|
||||
{"mcl_copper:trapdoor", 2}
|
||||
}
|
||||
-- Registering crafting recipes for blocks made with copper ingot.
|
||||
for i = 1, #made_of_ingots do
|
||||
register_ingot_recipes(made_of_ingots[i][1], made_of_ingots[i][2])
|
||||
end
|
||||
|
||||
-- Chiseled copper uses slabs as the main material.
|
||||
local chiseled_materials = {
|
||||
"mcl_stairs:slab_copper_cut",
|
||||
|
@ -203,38 +260,3 @@ minetest.register_craft({
|
|||
recipe = "mcl_copper:block_raw",
|
||||
cooktime = 90,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_copper:door 3",
|
||||
recipe = {
|
||||
{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot"},
|
||||
{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot"},
|
||||
{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_copper:trapdoor 2",
|
||||
recipe = {
|
||||
{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot"},
|
||||
{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mesecons_button:button_copper_off",
|
||||
recipe = {{"mcl_copper:copper_ingot"}}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_copper:pressure_plate_copper_off",
|
||||
recipe = {{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot"}}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xpanes:copper_flat 16",
|
||||
recipe = {
|
||||
{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot", "mcl_copper:copper_ingot"},
|
||||
{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot", "mcl_copper:copper_ingot"}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -186,14 +186,14 @@ mcl_copper.button_descs = {
|
|||
S("Weathered Copper Button"), S("Waxed Weathered Copper Button"),
|
||||
S("Oxidized Copper Button"), S("Waxed Oxidized Copper Button")
|
||||
}
|
||||
|
||||
-- Description for copper pressure plates, selected by its position on the table.
|
||||
mcl_copper.pp_descs = {
|
||||
S("Copper Pressure Plate"), S("Waxed Copper Pressure Plate"),
|
||||
S("Exposed Copper Pressure Plate"), S("Waxed Exposed Copper Pressure Plate"),
|
||||
S("Weathered Copper Pressure Plate"), S("Waxed Weathered Copper Pressure Plate"),
|
||||
S("Oxidized Copper Pressure Plate"), S("Waxed Oxidized Copper Pressure Plate")
|
||||
}
|
||||
|
||||
-- Description for copper bars, selected by its position on the table.
|
||||
mcl_copper.bars_descs = {
|
||||
S("Copper Bars"), S("Waxed Copper Bars"),
|
||||
S("Exposed Copper Bars"), S("Waxed Exposed Copper Bars"),
|
||||
|
|
|
@ -183,7 +183,7 @@ local mods_and_blocks = {
|
|||
{"mcl_copper", "pressure_plate_copper", "pressure_plate_waxed_copper"},
|
||||
{"mcl_copper", "trapdoor", "waxed_trapdoor"}
|
||||
}
|
||||
-- Defining variants for all blocks registered by other API's.
|
||||
-- Defining variants for almost all blocks registered by other API's.
|
||||
for _, mod_and_blocks in pairs(mods_and_blocks) do
|
||||
local mod = mod_and_blocks[1]
|
||||
local oxidize_and_scrap = mod_and_blocks[2]
|
||||
|
@ -192,7 +192,7 @@ 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
|
||||
|
||||
-- Redefining things to handle mcl_stairs copper nodes.
|
||||
for i = 1, 4 do
|
||||
decay_chain[i] = decay_chain[i].."_cut"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue