Copper buttons and some small changes

This commit is contained in:
JoseDouglas26 2024-05-08 06:25:09 -03:00
parent ba5c0a7f74
commit 25219c7102
5 changed files with 48 additions and 4 deletions

View File

@ -207,10 +207,12 @@ function mesecon.register_button(basename, description, texture, recipeitem, sou
_mcl_hardness = 0.5,
})
minetest.register_craft({
output = "mesecons_button:button_"..basename.."_off",
recipe = {{ recipeitem }},
})
if recipeitem then
minetest.register_craft({
output = "mesecons_button:button_"..basename.."_off",
recipe = {{ recipeitem }},
})
end
if minetest.get_modpath("mesecons_mvps") then
mesecon.register_mvps_unsticky("mesecons_button:button_"..basename.."_off")

View File

@ -220,3 +220,8 @@ minetest.register_craft({
{"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"}}
})

View File

@ -179,3 +179,10 @@ mcl_copper.doors_descs = {
{S("Oxidized Copper Door"), S("Oxidized Copper Trapdoor")},
{S("Waxed Oxidized Copper Door"), S("Waxed Oxidized Copper Trapdoor")}
}
-- Description for copper buttons, selected by its position on the table.
mcl_copper.button_descs = {
S("Copper Button"), S("Waxed Copper Button"),
S("Exposed Copper Button"), S("Waxed Exposed Copper Button"),
S("Weathered Copper Button"), S("Waxed Weathered Copper Button"),
S("Oxidized Copper Button"), S("Waxed Oxidized Copper Button")
}

View File

@ -12,6 +12,11 @@ local function register_oxidation_and_scraping(mod_name, subname, decay_chain)
for i = 1, #decay_chain - 1 do
item = mod_name..":"..subname..decay_chain[i]
oxidized_item = mod_name..":"..subname..decay_chain[i + 1]
-- Copper buttons have a special treatment due to the format of your name.
if subname:find("button") then
item = item.."_off"
oxidized_item = oxidized_item.."_off"
end
minetest.override_item(item, {_mcl_oxidized_variant = oxidized_item})
minetest.override_item(oxidized_item, {_mcl_stripped_variant = item})
@ -64,6 +69,11 @@ local function register_waxing_and_scraping(mod_name, subname, decay_chain)
for i = 1, #decay_chain do
waxed_item = mod_name..":"..subname..decay_chain[i]
unwaxed_item = mod_name..":"..subname:gsub("waxed_", "")..decay_chain[i]
-- Copper buttons have a special treatment due to the format of your name.
if subname:find("button") then
waxed_item = waxed_item.."_off"
unwaxed_item = unwaxed_item.."_off"
end
minetest.override_item(waxed_item, {_mcl_stripped_variant = unwaxed_item})
minetest.override_item(unwaxed_item, {_mcl_waxed_variant = waxed_item})
@ -116,9 +126,13 @@ register_oxidation_and_scraping("mcl_copper", "trapdoor", decay_chain)
register_oxidation_and_scraping("mcl_copper", "door", decay_chain)
register_oxidation_and_scraping("mesecons_button", "button_copper", decay_chain)
register_waxing_and_scraping("mcl_copper", "waxed_trapdoor", decay_chain)
register_waxing_and_scraping("mcl_copper", "waxed_door", decay_chain)
register_waxing_and_scraping("mesecons_button", "button_waxed_copper", decay_chain)
-- Redefining values and using decay chains for stairs and slabs.
for i = 1, 4 do
decay_chain[i] = decay_chain[i].."_cut"

View File

@ -230,6 +230,21 @@ local function register_copper_variants(name, definitions)
_mcl_hardness = 3
})
end
-- Registering buttons.
if definitions._mesecons_buttons then
mesecon.register_button(
names[i]:gsub("block", "copper"),
mcl_copper.button_descs[i],
set_tiles(tiles, i),
nil,
mcl_sounds.node_sound_metal_defaults(),
set_groups(names[i], {handy = 1, pickaxey = 1}),
math.ceil(i / 2) * 0.5,
true,
nil,
"mesecons_button_push"
)
end
end
end
-- Using the function above to register the copper blocks.
@ -238,6 +253,7 @@ register_copper_variants("block", {
-- Copper blocks are no longer the manufacturing material for doors but this definition will be
-- maintained here to avoid individual registration of 16 blocks.
_mcl_doors = true,
_mesecons_buttons = true,
})
-- Using the function above to register the cut copper blocks.
register_copper_variants("cut", {