From af3bee7017eb0a2b9e9abb7f8d1ac67a9ce38827 Mon Sep 17 00:00:00 2001 From: JoseDouglas26 Date: Tue, 14 May 2024 10:21:57 -0300 Subject: [PATCH] Copper pressure plates --- .../REDSTONE/mesecons_pressureplates/init.lua | 12 +++++++----- mods/ITEMS/mcl_copper/crafting.lua | 5 +++++ mods/ITEMS/mcl_copper/descriptions.lua | 7 +++++++ mods/ITEMS/mcl_copper/functions.lua | 4 +++- mods/ITEMS/mcl_copper/nodes.lua | 16 ++++++++++++++++ 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua b/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua index a4043fb5f..6fa56e1fd 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua @@ -208,11 +208,13 @@ function mesecon.register_pressure_plate(basename, description, textures_off, te _doc_items_create_entry = false, }) - minetest.register_craft({ - output = basename .. "_off", - recipe = recipe, - }) - + if recipe then + minetest.register_craft({ + output = basename .. "_off", + recipe = recipe, + }) + end + if minetest.get_modpath("doc") then doc.add_entry_alias("nodes", basename .. "_off", "nodes", basename .. "_on") end diff --git a/mods/ITEMS/mcl_copper/crafting.lua b/mods/ITEMS/mcl_copper/crafting.lua index 13b516389..802b0e7ee 100644 --- a/mods/ITEMS/mcl_copper/crafting.lua +++ b/mods/ITEMS/mcl_copper/crafting.lua @@ -225,3 +225,8 @@ 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"}} +}) diff --git a/mods/ITEMS/mcl_copper/descriptions.lua b/mods/ITEMS/mcl_copper/descriptions.lua index 29cd073bf..8be225950 100644 --- a/mods/ITEMS/mcl_copper/descriptions.lua +++ b/mods/ITEMS/mcl_copper/descriptions.lua @@ -186,3 +186,10 @@ mcl_copper.button_descs = { S("Weathered Copper Button"), S("Waxed Weathered Copper Button"), S("Oxidized Copper Button"), S("Waxed Oxidized Copper Button") } + +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") +} diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index 7982e3cfc..3cf7fedd4 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -55,7 +55,7 @@ local function register_oxidation_and_scraping(mod_name, subname, decay_chain) 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 + if subname:find("button") or subname:find("pressure_plate") then item = item.."_off" oxidized_item = oxidized_item.."_off" end @@ -170,6 +170,8 @@ register_oxidation_and_scraping("mcl_copper", "door", decay_chain) register_oxidation_and_scraping("mesecons_button", "button_copper", decay_chain) +register_oxidation_and_scraping("mcl_copper", "pressure_plate_copper", decay_chain) + register_waxing_and_scraping("mcl_copper", "waxed_trapdoor", decay_chain) register_waxing_and_scraping("mcl_copper", "waxed_door", decay_chain) diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index e2de7ea94..0e20a6b57 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -245,6 +245,21 @@ local function register_copper_variants(name, definitions) "mesecons_button_push" ) end + + if definitions._mesecons_pp then + mesecon.register_pressure_plate( + "mcl_copper:pressure_plate_"..names[i]:gsub("block", "copper"), + mcl_copper.pp_descs[i], + {set_tiles(tiles, i)}, + {set_tiles(tiles, i)}, + set_tiles(tiles, i), + nil, + nil, + mcl_sounds.node_sound_metal_defaults(), + set_groups(names[i], {pickaxey = 1}), + {player = true, mob = true} + ) + end end end -- Using the function above to register the copper blocks. @@ -254,6 +269,7 @@ register_copper_variants("block", { -- maintained here to avoid individual registration of 16 blocks. _mcl_doors = true, _mesecons_buttons = true, + _mesecons_pp = true }) -- Using the function above to register the cut copper blocks. register_copper_variants("cut", {