forked from VoxeLibre/VoxeLibre
Merge branch 'master' of https://git.minetest.land/JoseDouglas26/MineClone2
This commit is contained in:
commit
c0a0bd5b9c
|
@ -1,11 +1,16 @@
|
||||||
--- This function determines the format of the crafting recipe in the crafting grid based on the
|
--- 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).
|
--- 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
|
--- 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 name string
|
||||||
---@param material string
|
---@param material string|nil
|
||||||
---@return table
|
---@return table
|
||||||
local function get_shape(name, material)
|
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.
|
if name == "cut" then -- Shape of cut copper blocks.
|
||||||
return {
|
return {
|
||||||
{material, material},
|
{material, material},
|
||||||
|
@ -28,6 +33,28 @@ local function get_shape(name, material)
|
||||||
{material, "mcl_mobitems:blaze_rod", material},
|
{material, "mcl_mobitems:blaze_rod", material},
|
||||||
{"", "mesecons:redstone", ""}
|
{"", "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
|
else
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
@ -87,6 +114,36 @@ 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)
|
||||||
|
|
||||||
|
--- 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.
|
-- Chiseled copper uses slabs as the main material.
|
||||||
local chiseled_materials = {
|
local chiseled_materials = {
|
||||||
"mcl_stairs:slab_copper_cut",
|
"mcl_stairs:slab_copper_cut",
|
||||||
|
@ -203,38 +260,3 @@ minetest.register_craft({
|
||||||
recipe = "mcl_copper:block_raw",
|
recipe = "mcl_copper:block_raw",
|
||||||
cooktime = 90,
|
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("Weathered Copper Button"), S("Waxed Weathered Copper Button"),
|
||||||
S("Oxidized Copper Button"), S("Waxed Oxidized 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 = {
|
mcl_copper.pp_descs = {
|
||||||
S("Copper Pressure Plate"), S("Waxed Copper Pressure Plate"),
|
S("Copper Pressure Plate"), S("Waxed Copper Pressure Plate"),
|
||||||
S("Exposed Copper Pressure Plate"), S("Waxed Exposed 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("Weathered Copper Pressure Plate"), S("Waxed Weathered Copper Pressure Plate"),
|
||||||
S("Oxidized Copper Pressure Plate"), S("Waxed Oxidized 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 = {
|
mcl_copper.bars_descs = {
|
||||||
S("Copper Bars"), S("Waxed Copper Bars"),
|
S("Copper Bars"), S("Waxed Copper Bars"),
|
||||||
S("Exposed Copper Bars"), S("Waxed Exposed Copper Bars"),
|
S("Exposed Copper Bars"), S("Waxed Exposed Copper Bars"),
|
||||||
|
|
|
@ -197,7 +197,7 @@ local mods_and_blocks = {
|
||||||
{"mcl_stairs", "stair_copper", "stair_waxed_copper"},
|
{"mcl_stairs", "stair_copper", "stair_waxed_copper"},
|
||||||
{"mcl_copper", "trapdoor", "waxed_trapdoor"}
|
{"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
|
for _, mod_and_blocks in pairs(mods_and_blocks) do
|
||||||
local mod = mod_and_blocks[1]
|
local mod = mod_and_blocks[1]
|
||||||
local oxidize_and_scrap = mod_and_blocks[2]
|
local oxidize_and_scrap = mod_and_blocks[2]
|
||||||
|
|
Loading…
Reference in New Issue