1
0
Fork 0

More copper blocks and crafting "api"

copper-adaptation-refs-recovery
JoseDouglas26 2024-02-08 10:18:34 -03:00
parent e6c0ab0572
commit 73a053615e
3 changed files with 273 additions and 192 deletions

View File

@ -17,222 +17,135 @@ minetest.register_craft({
})
minetest.register_craft({
output = "mcl_copper:cut 4",
output = "mcl_copper:block_raw",
recipe = {
{ "mcl_copper:block", "mcl_copper:block" },
{ "mcl_copper:block", "mcl_copper:block" },
{ "mcl_copper:raw_copper", "mcl_copper:raw_copper", "mcl_copper:raw_copper" },
{ "mcl_copper:raw_copper", "mcl_copper:raw_copper", "mcl_copper:raw_copper" },
{ "mcl_copper:raw_copper", "mcl_copper:raw_copper", "mcl_copper:raw_copper" },
},
})
minetest.register_craft({
output = "mcl_copper:waxed_cut 4",
output = "mcl_copper:block",
recipe = {
{ "mcl_copper:waxed_block", "mcl_copper:waxed_block" },
{ "mcl_copper:waxed_block", "mcl_copper:waxed_block" },
{ "mcl_copper:copper_ingot", "mcl_copper:copper_ingot", "mcl_copper:copper_ingot" },
{ "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:cut_exposed 4",
recipe = {
{ "mcl_copper:block_exposed", "mcl_copper:block_exposed" },
{ "mcl_copper:block_exposed", "mcl_copper:block_exposed" },
},
})
local function get_shape(name, material)
if name == "cut" then
return {
{material, material},
{material, material}
}
elseif name == "grate" then
return {
{"", material, ""},
{material, "", material},
{"", material, ""}
}
elseif name == "chiseled" then
return {
{material},
{material},
}
elseif name == "door" then
return {
{material, material},
{material, material},
{material, material}
}
elseif name == "trapdoor" then
return {
{material, material, material},
{material, material, material}
}
elseif name == "bulb_off" then
return {
{"", material, ""},
{material, "mcl_mobitems:blaze_rod", material},
{"", "mesecons:redstone", ""}
}
else
return {}
end
end
minetest.register_craft({
output = "mcl_copper:waxed_cut_exposed 4",
recipe = {
{ "mcl_copper:waxed_block_exposed", "mcl_copper:waxed_block_exposed" },
{ "mcl_copper:waxed_block_exposed", "mcl_copper:waxed_block_exposed" },
},
})
minetest.register_craft({
output = "mcl_copper:cut_weathered 4",
recipe = {
{ "mcl_copper:block_weathered", "mcl_copper:block_weathered" },
{ "mcl_copper:block_weathered", "mcl_copper:block_weathered" },
},
})
minetest.register_craft({
output = "mcl_copper:waxed_cut_weathered 4",
recipe = {
{ "mcl_copper:waxed_block_weathered", "mcl_copper:waxed_block_weathered" },
{ "mcl_copper:waxed_block_weathered", "mcl_copper:waxed_block_weathered" },
},
})
minetest.register_craft({
output = "mcl_copper:cut_oxidized 4",
recipe = {
{ "mcl_copper:block_oxidized", "mcl_copper:block_oxidized" },
{ "mcl_copper:block_oxidized", "mcl_copper:block_oxidized" },
},
})
minetest.register_craft({
output = "mcl_copper:waxed_cut_oxidized 4",
recipe = {
{ "mcl_copper:waxed_block_oxidized", "mcl_copper:waxed_block_oxidized" },
{ "mcl_copper:waxed_block_oxidized", "mcl_copper:waxed_block_oxidized" },
},
})
minetest.register_craft({
output = "mcl_copper:grate 4",
recipe = {
{ "", "mcl_copper:block", "" },
{ "mcl_copper:block", "", "mcl_copper:block" },
{ "", "mcl_copper:block", "" }
function mcl_copper.register_variants_recipes(name, material, amount)
local materials = {}
local names = {
name, "waxed_"..name,
name.."_exposed", "waxed_"..name.."_exposed",
name.."_weathered", "waxed_"..name.."_weathered",
name.."_oxidized", "waxed_"..name.."_oxidized"
}
})
if type(material) == "string" then
materials = {
"mcl_copper:"..material, "mcl_copper:waxed_"..material,
"mcl_copper:"..material.."_exposed", "mcl_copper:waxed_"..material.."_exposed",
"mcl_copper:"..material.."_weathered", "mcl_copper:waxed_"..material.."_weathered",
"mcl_copper:"..material.."_oxidized", "mcl_copper:waxed_"..material.."_oxidized"
}
elseif type(material) == "table" then
if #material == 8 then
materials = material
else
return
end
else
return
end
minetest.register_craft({
output = "mcl_copper:waxed_grate 4",
recipe = {
{ "", "mcl_copper:waxed_block", "" },
{ "mcl_copper:waxed_block", "", "mcl_copper:waxed_block" },
{ "", "mcl_copper:waxed_block", "" }
}
})
for i = 1, 8 do
minetest.register_craft({
output = "mcl_copper:"..names[i].." "..tostring(amount),
recipe = get_shape(name, materials[i])
})
end
end
minetest.register_craft({
output = "mcl_copper:grate_exposed 4",
recipe = {
{ "", "mcl_copper:block_exposed", "" },
{ "mcl_copper:block_exposed", "", "mcl_copper:block_exposed" },
{ "", "mcl_copper:block_exposed", "" }
}
})
mcl_copper.register_variants_recipes("cut", "block", 4)
mcl_copper.register_variants_recipes("grate", "block", 4)
--mcl_copper.register_variants_recipes("door", "block", 3)
--mcl_copper.register_variants_recipes("trapdoor", "block", 2)
mcl_copper.register_variants_recipes("bulb_off", "block", 4)
minetest.register_craft({
output = "mcl_copper:waxed_grate_exposed 4",
recipe = {
{ "", "mcl_copper:waxed_block_exposed", "" },
{ "mcl_copper:waxed_block_exposed", "", "mcl_copper:waxed_block_exposed" },
{ "", "mcl_copper:waxed_block_exposed", "" }
}
})
local chiseled_materials = {
"mcl_stairs:slab_copper_cut",
"mcl_stairs:slab_waxed_copper_cut",
"mcl_stairs:slab_copper_exposed_cut",
"mcl_stairs:slab_waxed_copper_exposed_cut",
"mcl_stairs:slab_copper_weathered_cut",
"mcl_stairs:slab_waxed_copper_weathered_cut",
"mcl_stairs:slab_copper_oxidized_cut",
"mcl_stairs:slab_waxed_copper_oxidized_cut"
}
minetest.register_craft({
output = "mcl_copper:grate_weathered 4",
recipe = {
{ "", "mcl_copper:block_weathered", "" },
{ "mcl_copper:block_weathered", "", "mcl_copper:block_weathered" },
{ "", "mcl_copper:block_weathered", "" }
}
})
minetest.register_craft({
output = "mcl_copper:waxed_grate_weathered 4",
recipe = {
{ "", "mcl_copper:waxed_block_weathered", "" },
{ "mcl_copper:waxed_block_weathered", "", "mcl_copper:waxed_block_weathered" },
{ "", "mcl_copper:waxed_block_weathered", "" }
}
})
minetest.register_craft({
output = "mcl_copper:grate_oxidized 4",
recipe = {
{ "", "mcl_copper:block_oxidized", "" },
{ "mcl_copper:block_oxidized", "", "mcl_copper:block_oxidized" },
{ "", "mcl_copper:block_oxidized", "" }
}
})
minetest.register_craft({
output = "mcl_copper:waxed_grate_oxidized 4",
recipe = {
{ "", "mcl_copper:waxed_block_oxidized", "" },
{ "mcl_copper:waxed_block_oxidized", "", "mcl_copper:waxed_block_oxidized" },
{ "", "mcl_copper:waxed_block_oxidized", "" }
}
})
minetest.register_craft({
output = "mcl_copper:chiseled 1",
recipe = {
{ "mcl_stairs:slab_copper_cut" },
{ "mcl_stairs:slab_copper_cut" }
}
})
minetest.register_craft({
output = "mcl_copper:waxed_chiseled 1",
recipe = {
{ "mcl_stairs:slab_waxed_copper_cut" },
{ "mcl_stairs:slab_waxed_copper_cut" }
}
})
minetest.register_craft({
output = "mcl_copper:chiseled_exposed 1",
recipe = {
{ "mcl_stairs:slab_copper_exposed_cut" },
{ "mcl_stairs:slab_copper_exposed_cut" }
}
})
minetest.register_craft({
output = "mcl_copper:waxed_chiseled_exposed 1",
recipe = {
{ "mcl_stairs:slab_waxed_copper_exposed_cut" },
{ "mcl_stairs:slab_waxed_copper_exposed_cut" }
}
})
minetest.register_craft({
output = "mcl_copper:chiseled_weathered 1",
recipe = {
{ "mcl_stairs:slab_copper_weathered_cut" },
{ "mcl_stairs:slab_copper_weathered_cut" }
}
})
minetest.register_craft({
output = "mcl_copper:waxed_chiseled_weathered 1",
recipe = {
{ "mcl_stairs:slab_waxed_copper_weathered_cut" },
{ "mcl_stairs:slab_waxed_copper_weathered_cut" }
}
})
minetest.register_craft({
output = "mcl_copper:chiseled_oxidized 1",
recipe = {
{ "mcl_stairs:slab_copper_oxidized_cut" },
{ "mcl_stairs:slab_copper_oxidized_cut" }
}
})
minetest.register_craft({
output = "mcl_copper:waxed_chiseled_oxidized 1",
recipe = {
{ "mcl_stairs:slab_waxed_copper_oxidized_cut" },
{ "mcl_stairs:slab_waxed_copper_oxidized_cut" }
}
})
mcl_copper.register_variants_recipes("chiseled", chiseled_materials, 1)
local waxable_blocks = {
"block",
"cut",
"grate",
"chiseled",
"bulb_off",
"block_exposed",
"cut_exposed",
"grate_exposed",
"chiseled_exposed",
"bulb_off_exposed",
"block_weathered",
"cut_weathered",
"grate_weathered",
"chiseled_weathered",
"bulb_off_weathered",
"block_oxidized",
"cut_oxidized",
"grate_oxidized",
"chiseled_oxidized"
"chiseled_oxidized",
"bulb_off_oxidized"
}
for _, w in ipairs(waxable_blocks) do

View File

@ -22,6 +22,30 @@ mcl_copper.copper_descs = {
"Exposed Chiseled Copper", "Waxed Exposed Chiseled Copper",
"Weathered Chiseled Copper", "Waxed Weathered Chiseled Copped",
"Oxidized Chiseled Copper", "Waxed Oxidized Chiseled Copper"
},
["bulb_off"] = {
"Copper Bulb", "Waxed Copper Bulb",
"Exposed Copper Bulb", "Waxed Exposed Copper Bulb",
"Weathered Copper Bulb", "Waxed Weathered Copper Bulb",
"Oxidized Copper Bulb", "Waxed Oxidized Copper Bulb"
},
["bulb_on"] = {
"Lit Copper Bulb", "Lit Waxed Copper Bulb",
"Lit Exposed Copper Bulb", "Lit Waxed Exposed Copper Bulb",
"Lit Weathered Copper Bulb", "Lit Waxed Weathered Copper Bulb",
"Lit Oxidized Copper Bulb", "Lit Waxed Oxidized Copper Bulb"
},
["bulb_powered_off"] = {
"Powered Copper Bulb", "Powered Waxed Copper Bulb",
"Powered Exposed Copper Bulb", "Powered Waxed Exposed Copper Bulb",
"Powered Weathered Copper Bulb", "Powered Waxed Weathered Copper Bulb",
"Powered Oxidized Copper Bulb", "Powered Waxed Oxidized Copper Bulb"
},
["bulb_powered_on"] = {
"Powered Lit Copper Bulb", "Powered Lit Waxed Copper Bulb",
"Powered Lit Exposed Copper Bulb", "Powered Lit Waxed Exposed Copper Bulb",
"Powered Lit Weathered Copper Bulb", "Powered Lit Waxed Weathered Copper Bulb",
"Powered Lit Oxidized Copper Bulb", "Powered Lit Waxed Oxidized Copper Bulb"
}
}
@ -49,6 +73,30 @@ mcl_copper.copper_longdescs = {
"Exposed chiseled copper is a decorative block.",
"Weathered chiseled copper is a decorative block.",
"Oxidized chiseled copper is a decorative block."
},
["bulb_off"] = {
"Copper bulb is a decorative block and a light source when lited.",
"Exposed copper bulb is a decorative block and a light source when lited.",
"Weathered copper bulb is a decorative block and a light source when lited.",
"Oxidized copper bulb is a decorative block and a light source when lited."
},
["bulb_on"] = {
"Copper bulb is a decorative block and a light source.",
"Exposed copper bulb is a decorative block and a light source.",
"Weathered copper bulb is a decorative block and a light source.",
"Oxidized copper bulb is a decorative block and a light source."
},
["bulb_powered_off"] = {
"Copper bulb is a decorative block and a light source when lited.",
"Exposed copper bulb is a decorative block and a light source when lited.",
"Weathered copper bulb is a decorative block and a light source when lited.",
"Oxidized copper bulb is a decorative block and a light source when lited."
},
["bulb_powered_on"] = {
"Copper bulb is a decorative block and a light source.",
"Exposed copper bulb is a decorative block and a light source.",
"Weathered copper bulb is a decorative block and a light source.",
"Oxidized copper bulb is a decorative block and a light source."
}
}
@ -87,3 +135,14 @@ mcl_copper.stairs_descs = {
"Waxed Slab of Oxidized Cut Copper", "Waxed Double Slab of Oxidized Cut Copper", "Waxed Stairs of Oxidized Cut Copper"
}
}
mcl_copper.doors_descs = {
{"Copper Door", "Copper Trapdoor"},
{"Waxed Copper Door", "Waxed Copper Trapdoor"},
{"Exposed Copper Door", "Exposed Copper Trapdoor"},
{"Waxed Exposed Copper Door", "Waxed Exposed Copper Trapdoor"},
{"Weathered Copper Door", "Weathered Copper Trapdoor"},
{"Waxed Weathered Copper Door", "Waxed Weathered Copper Trapdoor"},
{"Oxidized Copper Door", "Oxidized Copper Trapdoor"},
{"Waxed Oxidized Copper Door", "Waxed Oxidized Copper Trapdoor"}
}

View File

@ -1,8 +1,9 @@
local S = minetest.get_translator("mcl_copper")
function mcl_copper.register_copper_variants(name, definitions)
local light_level = nil
local oxidized_variant, stripped_variant, waxed_variant
local groups = table.copy(definitions.groups)
local mcl_copper_groups = table.copy(definitions.groups)
local names = {
name, "waxed_"..name,
name.."_exposed", "waxed_"..name.."_exposed",
@ -18,11 +19,11 @@ function mcl_copper.register_copper_variants(name, definitions)
for i = 1, #names do
if names[i]:find("waxed") then
groups.waxed = 1
mcl_copper_groups.waxed = 1
stripped_variant = "mcl_copper:"..names[i-1]
else
if not names[i]:find("oxidized") then
groups.oxidizable = 1
mcl_copper_groups.oxidizable = 1
oxidized_variant = "mcl_copper:"..names[i+2]
end
if i ~= 1 then
@ -31,12 +32,17 @@ function mcl_copper.register_copper_variants(name, definitions)
waxed_variant = "mcl_copper:"..names[i+1]
end
if definitions.light_source then
light_level = definitions.light_source-3*(math.ceil(i/2)-1)-math.floor(i/5)-math.floor(i/7)
end
minetest.register_node("mcl_copper:"..names[i], {
description = S(mcl_copper.copper_descs[name][i]),
drawtype = definitions.drawtype or "normal",
groups = groups,
groups = mcl_copper_groups,
is_ground_content = false,
light_source = nil,
light_source = light_level,
mesecons = definitions.mesecons,
paramtype = definitions.paramtype or "none",
paramtype2 = definitions.paramtype2 or "none",
sounds = mcl_sounds.node_sound_metal_defaults(),
@ -52,20 +58,72 @@ function mcl_copper.register_copper_variants(name, definitions)
if definitions._mcl_stairs then
local subname = mcl_copper.stairs_subnames[name][i]
groups.building_block = 0
local mcl_stairs_groups = table.copy(mcl_copper_groups)
mcl_stairs.register_slab(subname, "mcl_copper:"..names[i],
groups, {tiles[math.ceil(i/2)], tiles[math.ceil(i/2)], tiles[math.ceil(i/2)]},
mcl_stairs_groups, {tiles[math.ceil(i/2)], tiles[math.ceil(i/2)], tiles[math.ceil(i/2)]},
S(mcl_copper.stairs_descs[subname][1]), nil, nil, nil,
S(mcl_copper.stairs_descs[subname][2])
)
mcl_stairs.register_stair(subname, "mcl_copper:"..names[i],
groups, {tiles[math.ceil(i/2)], tiles[math.ceil(i/2)], tiles[math.ceil(i/2)],
mcl_stairs_groups, {tiles[math.ceil(i/2)], tiles[math.ceil(i/2)], tiles[math.ceil(i/2)],
tiles[math.ceil(i/2)], tiles[math.ceil(i/2)], tiles[math.ceil(i/2)]},
S(mcl_copper.stairs_descs[subname][3]), nil, nil, nil, "woodlike"
)
end
if definitions._mcl_doors then
local itemimg, lowertext, uppertext, frontimg, sideimg
local door_groups = table.copy(mcl_copper_groups)
local trapdoor_groups = table.copy(mcl_copper_groups)
door_groups.building_block = 0
door_groups.mesecon_effector_on = 1
trapdoor_groups.building_block = 0
trapdoor_groups.mesecon_effector_on = 1
if i % 2 == 1 then
itemimg = "mcl_copper_item_"..names[i]:gsub(name, "door")..".png"
lowertext = "mcl_copper_"..names[i]:gsub(name, "door").."_lower.png"
uppertext = "mcl_copper_"..names[i]:gsub(name, "door").."_upper.png"
frontimg = "mcl_copper_"..names[i]:gsub(name, "trapdoor")..".png"
sideimg = "mcl_copper_"..names[i]:gsub(name, "trapdoor").."_side.png"
else
itemimg = "mcl_copper_item_"..names[i-1]:gsub(name, "door")..".png"
lowertext = "mcl_copper_"..names[i-1]:gsub(name, "door").."_lower.png"
uppertext = "mcl_copper_"..names[i-1]:gsub(name, "door").."_upper.png"
frontimg = "mcl_copper_"..names[i-1]:gsub(name, "trapdoor")..".png"
sideimg = "mcl_copper_"..names[i-1]:gsub(name, "trapdoor").."_side.png"
end
mcl_doors:register_door("mcl_copper:"..names[i]:gsub(name, "door"), {
description = S(mcl_copper.doors_descs[i][1]),
groups = door_groups,
inventory_image = itemimg,
only_redstone_can_open = false,
sounds = mcl_sounds.node_sound_metal_defaults(),
sound_close = "doors_steel_door_close",
sound_open = "doors_steel_door_open",
tiles_bottom = lowertext,
tiles_top = uppertext,
_mcl_blast_resistance = 3,
_mcl_hardness = 3
})
mcl_doors:register_trapdoor("mcl_copper:"..names[i]:gsub(name, "trapdoor"), {
description = S(mcl_copper.doors_descs[i][2]),
groups = trapdoor_groups,
only_redstone_can_open = false,
sounds = mcl_sounds.node_sound_metal_defaults(),
sound_close = "doors_steel_door_close",
sound_open = "doors_steel_door_open",
tile_front = frontimg,
tile_side = sideimg,
wield_image = frontimg,
_mcl_blast_resistance = 3,
_mcl_hardness = 3
})
end
end
end
@ -98,15 +156,66 @@ mcl_copper.register_copper_variants("block", {
groups = {pickaxey = 2, building_block = 1},
--_mcl_doors = true,
})
mcl_copper.register_copper_variants("cut", {
groups = {pickaxey = 2, building_block = 1},
_mcl_stairs = true,
})
mcl_copper.register_copper_variants("grate", {
drawtype = "allfaces",
groups = {pickaxey = 2, building_block = 1, disable_suffocation = 1},
sunlight_propagates = true,
})
mcl_copper.register_copper_variants("chiseled", {
groups = {pickaxey = 2, building_block = 1}
})
mcl_copper.register_copper_variants("bulb_off", {
groups = {pickaxey = 2, building_block = 1},
mesecons = {
effector = {
action_on = function (pos, node)
minetest.swap_node(pos, {name = node.name:gsub("bulb_off", "bulb_powered_on")})
end
}
},
})
mcl_copper.register_copper_variants("bulb_on", {
groups = {pickaxey = 2, building_block = 1, not_in_creative_inventory = 1},
light_source = 14,
mesecons = {
effector = {
action_on = function (pos, node)
minetest.swap_node(pos, {name = node.name:gsub("bulb_on", "bulb_powered_off")})
end
}
},
paramtype = "light"
})
mcl_copper.register_copper_variants("bulb_powered_off", {
groups = {pickaxey = 2, building_block = 1, not_in_creative_inventory = 1},
mesecons = {
effector = {
action_off = function (pos, node)
minetest.swap_node(pos, {name = node.name:gsub("bulb_powered_off", "bulb_off")})
end
}
}
})
mcl_copper.register_copper_variants("bulb_powered_on", {
groups = {pickaxey = 2, building_block = 1, not_in_creative_inventory = 1},
light_source = 14,
mesecons = {
effector = {
action_off = function (pos, node)
minetest.swap_node(pos, {name = node.name:gsub("bulb_powered_on", "bulb_on")})
end
}
},
paramtype = "light"
})