From c767c617f870ac0fb941429e9fb7c1913c1b2af8 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Tue, 15 Nov 2022 14:02:05 -0700 Subject: [PATCH] Add waxing copper blocks --- mods/ITEMS/mcl_copper/crafting.lua | 20 ++- mods/ITEMS/mcl_copper/functions.lua | 28 ++++ mods/ITEMS/mcl_copper/init.lua | 2 +- mods/ITEMS/mcl_copper/locale/template.txt | 20 +++ mods/ITEMS/mcl_copper/nodes.lua | 196 ++++++++++++++++++++-- 5 files changed, 246 insertions(+), 20 deletions(-) diff --git a/mods/ITEMS/mcl_copper/crafting.lua b/mods/ITEMS/mcl_copper/crafting.lua index 7b1e183c7..ce280fcdf 100644 --- a/mods/ITEMS/mcl_copper/crafting.lua +++ b/mods/ITEMS/mcl_copper/crafting.lua @@ -47,6 +47,17 @@ minetest.register_craft({ }, }) +local waxable_blocks = { "block", "block_cut", "block_exposed", "block_exposed_cut", "block_weathered", "block_weathered_cut", "block_oxidized", "block_oxidized_cut" } + +for _, w in ipairs(waxable_blocks) do + minetest.register_craft({ + output = "mcl_copper:waxed_"..w, + recipe = { + { "mcl_copper:"..w, "mcl_honey:honeycomb" }, + }, + }) +end + minetest.register_craft({ output = "mcl_copper:copper_ingot 4", recipe = { @@ -73,4 +84,11 @@ minetest.register_craft({ output = "mcl_copper:copper_ingot", recipe = "mcl_copper:stone_with_copper", cooktime = 10, -}) \ No newline at end of file +}) + +minetest.register_craft({ + type = "cooking", + output = "mcl_copper:block", + recipe = "mcl_copper:block_raw", + cooktime = 90, +}) diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index b6e0cb7e2..81dfdb69d 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -12,6 +12,34 @@ local function register_oxidation_abm(abm_name, node_name, oxidized_variant) }) end +function waxing_copper_block(pos, node, player, itemstack, convert_to) + if itemstack:get_name() == "mcl_honey:honeycomb" then + node.name = convert_to + minetest.set_node(pos, node) + awards.unlock(player:get_player_name(), "mcl:wax_on") + if not minetest.is_creative_enabled(player:get_player_name()) then + itemstack:take_item() + end + else + return true + end +end + +function scraping_copper_block(pos, node, player, itemstack, convert_to) + if itemstack:get_name():find("axe") then + node.name = convert_to + minetest.set_node(pos, node) + awards.unlock(player:get_player_name(), "mcl:wax_off") + if not minetest.is_creative_enabled(player:get_player_name()) then + local tool = itemstack:get_name() + local wear = mcl_autogroup.get_wear(tool, "axey") + itemstack:add_wear(wear) + end + else + return true + end +end + --[[ local stairs = { {"stair", "exposed", "_inner", "cut_inner"}, diff --git a/mods/ITEMS/mcl_copper/init.lua b/mods/ITEMS/mcl_copper/init.lua index ea15e5827..a99d03f2c 100644 --- a/mods/ITEMS/mcl_copper/init.lua +++ b/mods/ITEMS/mcl_copper/init.lua @@ -1,6 +1,6 @@ local path = minetest.get_modpath("mcl_copper") +dofile(path .. "/functions.lua") dofile(path .. "/nodes.lua") dofile(path .. "/items.lua") dofile(path .. "/crafting.lua") -dofile(path .. "/functions.lua") \ No newline at end of file diff --git a/mods/ITEMS/mcl_copper/locale/template.txt b/mods/ITEMS/mcl_copper/locale/template.txt index 050c099ee..7022780ff 100644 --- a/mods/ITEMS/mcl_copper/locale/template.txt +++ b/mods/ITEMS/mcl_copper/locale/template.txt @@ -2,36 +2,56 @@ A block of copper is mostly a decorative block.= A block used for compact raw copper storage.= Block of Copper= +Waxed Block of Copper= Block of Raw Copper= Copper Ingot= Copper Ore= Cut copper is a decorative block.= Cut Copper= +Waxed Cut Copper= Double Slab of Cut Copper= Double Slab of Exposed Cut Copper= Double Slab of Oxidized Cut Copper= Double Slab of Weathered Cut Copper= +Waxed Double Slab of Cut Copper= +Waxed Double Slab of Exposed Cut Copper= +Waxed Double Slab of Oxidized Cut Copper= +Waxed Double Slab of Weathered Cut Copper= Exposed copper is a decorative block.= Exposed Copper= +Waxed Exposed Copper= Exposed cut copper is a decorative block.= Exposed Cut Copper= +Waxed Exposed Cut Copper= Molten Raw Copper. It is used to craft blocks.= Oxidized copper is a decorative block.= Oxidized Copper= +Waxed Oxidized Copper= Oxidized cut copper is a decorative block.= Oxidized Cut Copper= +Waxed Oxidized Cut Copper= Raw Copper. Mine a Copper Ore to get it.= Raw Copper= Slab of Cut Copper= Slab of Exposed Cut Copper= Slab of Oxidized Cut Copper= Slab of Weathered Cut Copper= +Waxed Slab of Cut Copper= +Waxed Slab of Exposed Cut Copper= +Waxed Slab of Oxidized Cut Copper= +Waxed Slab of Weathered Cut Copper= Some copper contained in stone, it is pretty common and can be found below sea level.= Stairs of Cut Copper= Stairs of Exposed Cut Copper= Stairs of Oxidized Cut Copper= Stairs of Weathered Cut Copper= +Waxed Stairs of Cut Copper= +Waxed Stairs of Exposed Cut Copper= +Waxed Stairs of Oxidized Cut Copper= +Waxed Stairs of Weathered Cut Copper= Weathered copper is a decorative block.= Weathered Copper= +Waxed Weathered Copper= Weathered cut copper is a decorative block.= Weathered Cut Copper= +Waxed Weathered Cut Copper= diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index 22c1bf807..75c2973da 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -35,6 +35,19 @@ minetest.register_node("mcl_copper:block", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 3, + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block") end, +}) + +minetest.register_node("mcl_copper:waxed_block", { + description = S("Waxed Block of Copper"), + _doc_items_longdesc = S("A block of copper is mostly a decorative block."), + tiles = {"mcl_copper_block.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 3, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block") end, }) minetest.register_node("mcl_copper:block_exposed", { @@ -47,18 +60,19 @@ minetest.register_node("mcl_copper:block_exposed", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_anti_oxidation_varient = "mcl_copper:block", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_exposed") end, }) -minetest.register_node("mcl_copper:block_oxidized", { - description = S("Oxidized Copper"), - _doc_items_longdesc = S("Oxidized copper is a decorative block."), - tiles = {"mcl_copper_oxidized.png"}, +minetest.register_node("mcl_copper:waxed_block_exposed", { + description = S("Waxed Exposed Copper"), + _doc_items_longdesc = S("Exposed copper is a decorative block."), + tiles = {"mcl_copper_exposed.png"}, is_ground_content = false, groups = {pickaxey = 2, building_block = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_anti_oxidation_varient = "mcl_copper:block_weathered", + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block") end, }) minetest.register_node("mcl_copper:block_weathered", { @@ -71,6 +85,44 @@ minetest.register_node("mcl_copper:block_weathered", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_anti_oxidation_varient = "mcl_copper:block_exposed", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_weathered") end, +}) + +minetest.register_node("mcl_copper:waxed_block_weathered", { + description = S("Waxed Weathered Copper"), + _doc_items_longdesc = S("Weathered copper is a decorative block."), + tiles = {"mcl_copper_weathered.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_exposed") end, +}) + +minetest.register_node("mcl_copper:block_oxidized", { + description = S("Oxidized Copper"), + _doc_items_longdesc = S("Oxidized copper is a decorative block."), + tiles = {"mcl_copper_oxidized.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + _mcl_anti_oxidation_varient = "mcl_copper:block_weathered", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_oxidized") end, +}) + +minetest.register_node("mcl_copper:waxed_block_oxidized", { + description = S("Waxed Oxidized Copper"), + _doc_items_longdesc = S("Oxidized copper is a decorative block."), + tiles = {"mcl_copper_oxidized.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_weather") end, }) minetest.register_node("mcl_copper:block_cut", { @@ -82,6 +134,19 @@ minetest.register_node("mcl_copper:block_cut", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_cut") end, +}) + +minetest.register_node("mcl_copper:waxed_block_cut", { + description = S("Waxed Cut Copper"), + _doc_items_longdesc = S("Cut copper is a decorative block."), + tiles = {"mcl_copper_block_cut.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_cut") end, }) minetest.register_node("mcl_copper:block_exposed_cut", { @@ -94,18 +159,19 @@ minetest.register_node("mcl_copper:block_exposed_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_anti_oxidation_varient = "mcl_copper:block_cut", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_exposed_cut") end, }) -minetest.register_node("mcl_copper:block_oxidized_cut", { - description = S("Oxidized Cut Copper"), - _doc_items_longdesc = S("Oxidized cut copper is a decorative block."), - tiles = {"mcl_copper_oxidized_cut.png"}, +minetest.register_node("mcl_copper:waxed_block_exposed_cut", { + description = S("Waxed Exposed Cut Copper"), + _doc_items_longdesc = S("Exposed cut copper is a decorative block."), + tiles = {"mcl_copper_exposed_cut.png"}, is_ground_content = false, groups = {pickaxey = 2, building_block = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_anti_oxidation_varient = "mcl_copper:block_weathered_cut", + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_cut") end, }) minetest.register_node("mcl_copper:block_weathered_cut", { @@ -118,6 +184,44 @@ minetest.register_node("mcl_copper:block_weathered_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_anti_oxidation_varient = "mcl_copper:block_exposed_cut", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_weathered_cut") end, +}) + +minetest.register_node("mcl_copper:waxed_block_weathered_cut", { + description = S("Waxed Weathered Cut Copper"), + _doc_items_longdesc = S("Weathered cut copper is a decorative block."), + tiles = {"mcl_copper_weathered_cut.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_exposed_cut") end, +}) + +minetest.register_node("mcl_copper:block_oxidized_cut", { + description = S("Oxidized Cut Copper"), + _doc_items_longdesc = S("Oxidized cut copper is a decorative block."), + tiles = {"mcl_copper_oxidized_cut.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + _mcl_anti_oxidation_varient = "mcl_copper:block_weathered_cut", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_oxidized_cut") end, +}) + +minetest.register_node("mcl_copper:waxed_block_oxidized_cut", { + description = S("Waxed Oxidized Cut Copper"), + _doc_items_longdesc = S("Oxidized cut copper is a decorative block."), + tiles = {"mcl_copper_oxidized_cut.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_weathered_cut") end, }) mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut", @@ -127,6 +231,13 @@ mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut", nil, nil, nil, S("Double Slab of Cut Copper")) +mcl_stairs.register_slab("waxed_copper_cut", "mcl_copper:waxed_block_cut", + {pickaxey = 2}, + {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"}, + S("Waxed Slab of Cut Copper"), + nil, nil, nil, + S("Waxed Double Slab of Cut Copper")) + mcl_stairs.register_slab("copper_exposed_cut", "mcl_copper:block_exposed_cut", {pickaxey = 2}, {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, @@ -134,12 +245,12 @@ mcl_stairs.register_slab("copper_exposed_cut", "mcl_copper:block_exposed_cut", nil, nil, nil, S("Double Slab of Exposed Cut Copper")) -mcl_stairs.register_slab("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", +mcl_stairs.register_slab("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", {pickaxey = 2}, - {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, - S("Slab of Oxidized Cut Copper"), + {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, + S("Waxed Slab of Exposed Cut Copper"), nil, nil, nil, - S("Double Slab of Oxidized Cut Copper")) + S("Waxed Double Slab of Exposed Cut Copper")) mcl_stairs.register_slab("copper_weathered_cut", "mcl_copper:block_weathered_cut", {pickaxey = 2}, @@ -148,6 +259,27 @@ mcl_stairs.register_slab("copper_weathered_cut", "mcl_copper:block_weathered_cut nil, nil, nil, S("Double Slab of Weathered Cut Copper")) +mcl_stairs.register_slab("waxed_copper_weathered_cut", "mcl_copper:waxed_block_weathered_cut", + {pickaxey = 2}, + {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"}, + S("Waxed Slab of Weathered Cut Copper"), + nil, nil, nil, + S("Waxed Double Slab of Weathered Cut Copper")) + +mcl_stairs.register_slab("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", + {pickaxey = 2}, + {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, + S("Slab of Oxidized Cut Copper"), + nil, nil, nil, + S("Double Slab of Oxidized Cut Copper")) + +mcl_stairs.register_slab("waxed_copper_oxidized_cut", "mcl_copper:waxed_block_oxidized_cut", + {pickaxey = 2}, + {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, + S("Waxed Slab of Oxidized Cut Copper"), + nil, nil, nil, + S("Waxed Double Slab of Oxidized Cut Copper")) + mcl_stairs.register_stair("copper_cut", "mcl_copper:block_cut", {pickaxey = 2}, {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"}, @@ -155,6 +287,13 @@ mcl_stairs.register_stair("copper_cut", "mcl_copper:block_cut", nil, 6, nil, "woodlike") +mcl_stairs.register_stair("waxed_copper_cut", "mcl_copper:waxed_block_cut", + {pickaxey = 2}, + {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"}, + S("Waxed Stairs of Cut Copper"), + nil, 6, nil, + "woodlike") + mcl_stairs.register_stair("copper_exposed_cut", "mcl_copper:block_exposed_cut", {pickaxey = 2}, {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, @@ -162,10 +301,10 @@ mcl_stairs.register_stair("copper_exposed_cut", "mcl_copper:block_exposed_cut", nil, 6, nil, "woodlike") -mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", +mcl_stairs.register_stair("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", {pickaxey = 2}, - {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, - S("Stairs of Oxidized Cut Copper"), + {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, + S("Waxed Stairs of Exposed Cut Copper"), nil, 6, nil, "woodlike") @@ -174,4 +313,25 @@ mcl_stairs.register_stair("copper_weathered_cut", "mcl_copper:block_weathered_cu {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"}, S("Stairs of Weathered Cut Copper"), nil, 6, nil, - "woodlike") \ No newline at end of file + "woodlike") + +mcl_stairs.register_stair("waxed_copper_weathered_cut", "mcl_copper:waxed_block_weathered_cut", + {pickaxey = 2}, + {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"}, + S("Waxed Stairs of Weathered Cut Copper"), + nil, 6, nil, + "woodlike") + +mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", + {pickaxey = 2}, + {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, + S("Stairs of Oxidized Cut Copper"), + nil, 6, nil, + "woodlike") + +mcl_stairs.register_stair("waxed_copper_oxidized_cut", "mcl_copper:waxed_block_oxidized_cut", + {pickaxey = 2}, + {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, + S("Waxed Stairs of Oxidized Cut Copper"), + nil, 6, nil, + "woodlike")