From aa9603859bc6dc97faaaeae4e3c9c936f39bd1c7 Mon Sep 17 00:00:00 2001 From: JoseDouglas26 Date: Fri, 3 May 2024 13:36:39 -0300 Subject: [PATCH] New mcl_copper --- mods/CORE/mcl_oxidation/init.lua | 11 +- mods/ITEMS/mcl_copper/crafting.lua | 163 +++++- mods/ITEMS/mcl_copper/functions.lua | 209 +++---- mods/ITEMS/mcl_copper/init.lua | 1 + .../mcl_copper/locale/mcl_copper.pt_BR.tr | 59 ++ mods/ITEMS/mcl_copper/locale/template.txt | 59 ++ mods/ITEMS/mcl_copper/nodes.lua | 554 ++++++++---------- mods/ITEMS/mcl_honey/init.lua | 27 +- mods/ITEMS/mcl_tools/init.lua | 10 + 9 files changed, 636 insertions(+), 457 deletions(-) diff --git a/mods/CORE/mcl_oxidation/init.lua b/mods/CORE/mcl_oxidation/init.lua index 201d0260a..69439f6f2 100644 --- a/mods/CORE/mcl_oxidation/init.lua +++ b/mods/CORE/mcl_oxidation/init.lua @@ -6,7 +6,16 @@ minetest.register_abm({ action = function(pos, node) local def = minetest.registered_nodes[node.name] if def and def._mcl_oxidized_variant then - minetest.set_node(pos, { name = def._mcl_oxidized_variant, param2 = node.param2 }) + if def.groups.door == 1 then + if node.name:find("_b_") then + local top_pos = { x = pos.x, y = pos.y + 1, z = pos.z } + minetest.swap_node(top_pos, { name = def._mcl_oxidized_variant:gsub("_b_", "_t_"), param2 = node.param2 }) + elseif node.name:find("_t_") then + local bot_pos = { x = pos.x, y = pos.y - 1, z = pos.z } + minetest.swap_node(bot_pos, { name = def._mcl_oxidized_variant:gsub("_t_", "_b_"), param2 = node.param2 }) + end + end + minetest.swap_node(pos, { name = def._mcl_oxidized_variant, param2 = node.param2 }) end end, }) diff --git a/mods/ITEMS/mcl_copper/crafting.lua b/mods/ITEMS/mcl_copper/crafting.lua index 9b0976d3a..ec13fa429 100644 --- a/mods/ITEMS/mcl_copper/crafting.lua +++ b/mods/ITEMS/mcl_copper/crafting.lua @@ -16,39 +16,130 @@ minetest.register_craft({ }, }) -minetest.register_craft({ - output = "mcl_copper:block_cut 4", - recipe = { - { "mcl_copper:block", "mcl_copper:block" }, - { "mcl_copper:block", "mcl_copper:block" }, - }, -}) +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:block_exposed_cut 4", - recipe = { - { "mcl_copper:block_exposed", "mcl_copper:block_exposed" }, - { "mcl_copper:block_exposed", "mcl_copper:block_exposed" }, - }, -}) +function mcl_copper.register_variants_recipes(name, material, amount) + local names + local materials = {} + if name ~= "cut" then + names = { + name, "waxed_"..name, + name.."_exposed", "waxed_"..name.."_exposed", + name.."_weathered", "waxed_"..name.."_weathered", + name.."_oxidized", "waxed_"..name.."_oxidized" + } + else + names = { + "block_"..name, "waxed_block_"..name, + "block_exposed_"..name, "waxed_block_exposed_"..name, + "block_weathered_"..name, "waxed_block_weathered_"..name, + "block_oxidized_"..name, "waxed_block_oxidized_"..name + } + end -minetest.register_craft({ - output = "mcl_copper:block_oxidized_cut 4", - recipe = { - { "mcl_copper:block_oxidized", "mcl_copper:block_oxidized" }, - { "mcl_copper:block_oxidized", "mcl_copper:block_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:block_weathered_cut 4", - recipe = { - { "mcl_copper:block_weathered", "mcl_copper:block_weathered" }, - { "mcl_copper:block_weathered", "mcl_copper:block_weathered" }, - }, -}) + for i = 1, 8 do + minetest.register_craft({ + output = "mcl_copper:"..names[i].." "..tostring(amount), + recipe = get_shape(name, materials[i]) + }) + end +end -local waxable_blocks = { "block", "block_cut", "block_exposed", "block_exposed_cut", "block_weathered", "block_weathered_cut", "block_oxidized", "block_oxidized_cut" } +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) + +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" +} + +mcl_copper.register_variants_recipes("chiseled", chiseled_materials, 1) + +local waxable_blocks = { + "block", + "block_cut", + "grate", + "chiseled", + "bulb_off", + "block_exposed", + "block_exposed_cut", + "grate_exposed", + "chiseled_exposed", + "bulb_off_exposed", + "block_weathered", + "block_weathered_cut", + "grate_weathered", + "chiseled_weathered", + "bulb_off_weathered", + "block_oxidized", + "block_oxidized_cut", + "grate_oxidized", + "chiseled_oxidized", + "bulb_off_oxidized" +} for _, w in ipairs(waxable_blocks) do minetest.register_craft({ @@ -59,10 +150,22 @@ for _, w in ipairs(waxable_blocks) do }) end -local cuttable_blocks = { "block", "waxed_block", "block_exposed", "waxed_block_exposed", "block_weathered", "waxed_block_weathered", "block_oxidized", "waxed_block_oxidized" } +local cuttable_blocks = { + "block", + "waxed_block", + "block_exposed", + "waxed_block_exposed", + "block_weathered", + "waxed_block_weathered", + "block_oxidized", + "waxed_block_oxidized" +} for _, c in ipairs(cuttable_blocks) do mcl_stonecutter.register_recipe("mcl_copper:"..c, "mcl_copper:"..c.."_cut", 4) + mcl_stonecutter.register_recipe("mcl_copper:"..c, "mcl_copper:"..c:gsub("block", "grate"), 4) + mcl_stonecutter.register_recipe("mcl_copper:"..c, "mcl_copper:"..c:gsub("block", "chiseled"), 4) + mcl_stonecutter.register_recipe("mcl_copper:"..c.."_cut", "mcl_copper:"..c:gsub("block", "chiseled")) end minetest.register_craft({ diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index bd289f60f..5e2b04f77 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -1,132 +1,115 @@ -local stair_oxidization = { - { "cut", "exposed_cut" }, - { "cut_inner", "exposed_cut_inner" }, - { "cut_outer", "exposed_cut_outer" }, - { "exposed_cut", "weathered_cut" }, - { "exposed_cut_inner", "weathered_cut_inner" }, - { "exposed_cut_outer", "weathered_cut_outer" }, - { "weathered_cut", "oxidized_cut" }, - { "weathered_cut_inner", "oxidized_cut_inner" }, - { "weathered_cut_outer", "oxidized_cut_outer" } -} +function mcl_copper.register_oxidation_and_scraping(mod_name, subname, decay_chain) + local item, oxidized_item -local slab_oxidization = { - { "cut", "exposed_cut" }, - { "cut_top", "exposed_cut_top" }, - { "cut_double", "exposed_cut_double" }, - { "exposed_cut", "weathered_cut" }, - { "exposed_cut_top", "weathered_cut_top" }, - { "exposed_cut_double", "weathered_cut_double" }, - { "weathered_cut", "oxidized_cut" }, - { "weathered_cut_top", "oxidized_cut_top" }, - { "weathered_cut_double", "oxidized_cut_double" }, -} + for i = 1, #decay_chain - 1 do + item = mod_name..":"..subname..decay_chain[i] + oxidized_item = mod_name..":"..subname..decay_chain[i + 1] -local def -local def_variant_oxidized -local def_variant_waxed -local def_variant_scraped + minetest.override_item(item, {_mcl_oxidized_variant = oxidized_item}) + minetest.override_item(oxidized_item, {_mcl_stripped_variant = item}) --- set up oxidized and waxed variants. -for i = 1, #stair_oxidization do - -- stairs - def = "mcl_stairs:stair_copper_" .. stair_oxidization[i][1] - def_variant_oxidized = "mcl_stairs:stair_copper_" .. stair_oxidization[i][2] - minetest.override_item(def, { _mcl_oxidized_variant = def_variant_oxidized }) + if subname:find("stair") then + minetest.override_item(item.."_inner", {_mcl_oxidized_variant = oxidized_item.."_inner"}) + minetest.override_item(item.."_outer", {_mcl_oxidized_variant = oxidized_item.."_outer"}) + minetest.override_item(oxidized_item.."_inner", {_mcl_stripped_variant = item.."_inner"}) + minetest.override_item(oxidized_item.."_outer", {_mcl_stripped_variant = item.."_outer"}) + elseif subname:find("slab") then + minetest.override_item(item.."_double", {_mcl_oxidized_variant = oxidized_item.."_double"}) + minetest.override_item(item.."_top", {_mcl_oxidized_variant = oxidized_item.."_top"}) + minetest.override_item(oxidized_item.."_double", {_mcl_stripped_variant = item.."_double"}) + minetest.override_item(oxidized_item.."_top", {_mcl_stripped_variant = item.."_top"}) + elseif subname:find("trapdoor") then + minetest.override_item(item.."_open", {_mcl_oxidized_variant = oxidized_item.."_open"}) + minetest.override_item(oxidized_item.."_open", {_mcl_stripped_variant = item.."_open"}) + elseif subname == "door" then + minetest.override_item(item.."_b_1", {_mcl_oxidized_variant = oxidized_item.."_b_1"}) + minetest.override_item(oxidized_item.."_b_1", {_mcl_stripped_variant = item.."_b_1"}) + minetest.override_item(item.."_t_1", {_mcl_oxidized_variant = oxidized_item.."_t_1"}) + minetest.override_item(oxidized_item.."_t_1", {_mcl_stripped_variant = item.."_t_1"}) - def_variant_waxed = "mcl_stairs:stair_waxed_copper_" .. stair_oxidization[i][1] - minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed }) + minetest.override_item(item.."_b_2", {_mcl_oxidized_variant = oxidized_item.."_b_2"}) + minetest.override_item(oxidized_item.."_b_2", {_mcl_stripped_variant = item.."_b_2"}) + minetest.override_item(item.."_t_2", {_mcl_oxidized_variant = oxidized_item.."_t_2"}) + minetest.override_item(oxidized_item.."_t_2", {_mcl_stripped_variant = item.."_t_2"}) - -- slabs - def = "mcl_stairs:slab_copper_" .. slab_oxidization[i][1] - def_variant_oxidized = "mcl_stairs:slab_copper_" .. slab_oxidization[i][2] - minetest.override_item(def, { _mcl_oxidized_variant = def_variant_oxidized }) + minetest.override_item(item.."_b_3", {_mcl_oxidized_variant = oxidized_item.."_b_3"}) + minetest.override_item(oxidized_item.."_b_3", {_mcl_stripped_variant = item.."_b_3"}) + minetest.override_item(item.."_t_3", {_mcl_oxidized_variant = oxidized_item.."_t_3"}) + minetest.override_item(oxidized_item.."_t_3", {_mcl_stripped_variant = item.."_t_3"}) - def_variant_waxed = "mcl_stairs:slab_waxed_copper_" .. slab_oxidization[i][1] - minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed }) -end - --- Set up scraped variants. -for i = 1, #stair_oxidization do - -- does both stairs and slabs. - if i > 3 then - def = "mcl_stairs:stair_copper_" .. stair_oxidization[i][1] - def_variant_scraped = "mcl_stairs:stair_copper_" .. stair_oxidization[i - 3][1] - minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) - - def = "mcl_stairs:slab_copper_" .. slab_oxidization[i][1] - def_variant_scraped = "mcl_stairs:slab_copper_" .. slab_oxidization[i - 3][1] - minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) - end - if i > 6 then - def = "mcl_stairs:stair_copper_" .. stair_oxidization[i][2] - def_variant_scraped = "mcl_stairs:stair_copper_" .. stair_oxidization[i][1] - minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) - - def = "mcl_stairs:slab_copper_" .. slab_oxidization[i][2] - def_variant_scraped = "mcl_stairs:slab_copper_" .. slab_oxidization[i][1] - minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) + minetest.override_item(item.."_b_4", {_mcl_oxidized_variant = oxidized_item.."_b_4"}) + minetest.override_item(oxidized_item.."_b_4", {_mcl_stripped_variant = item.."_b_4"}) + minetest.override_item(item.."_t_4", {_mcl_oxidized_variant = oxidized_item.."_t_4"}) + minetest.override_item(oxidized_item.."_t_4", {_mcl_stripped_variant = item.."_t_4"}) + end end end --- Set up scraped variants for waxed stairs. -local waxed_variants = { - { "waxed_copper_cut", "copper_cut" }, - { "waxed_copper_exposed_cut", "copper_exposed_cut" }, - { "waxed_copper_weathered_cut", "copper_weathered_cut" }, - { "waxed_copper_oxidized_cut", "copper_oxidized_cut" }, -} +function mcl_copper.register_waxing_and_scraping(mod_name, subname, decay_chain) + local waxed_item, unwaxed_item -for i = 1, #waxed_variants do - -- stairs - def = "mcl_stairs:stair_" .. waxed_variants[i][1] - def_variant_scraped = "mcl_stairs:stair_" .. waxed_variants[i][2] - minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) + for i = 1, #decay_chain do + waxed_item = mod_name..":"..subname..decay_chain[i] + unwaxed_item = mod_name..":"..subname:gsub("waxed_", "")..decay_chain[i] - def = "mcl_stairs:stair_" .. waxed_variants[i][1] .. "_inner" - def_variant_scraped = "mcl_stairs:stair_" .. waxed_variants[i][2] .. "_inner" - minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) + minetest.override_item(waxed_item, {_mcl_stripped_variant = unwaxed_item}) + minetest.override_item(unwaxed_item, {_mcl_waxed_variant = waxed_item}) - def = "mcl_stairs:stair_" .. waxed_variants[i][1] .. "_outer" - def_variant_scraped = "mcl_stairs:stair_" .. waxed_variants[i][2] .. "_outer" - minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) + if subname:find("stair") then + minetest.override_item(waxed_item.."_inner", {_mcl_stripped_variant = unwaxed_item.."_inner"}) + minetest.override_item(waxed_item.."_outer", {_mcl_stripped_variant = unwaxed_item.."_outer"}) + minetest.override_item(unwaxed_item.."_inner", {_mcl_waxed_variant = waxed_item.."_inner"}) + minetest.override_item(unwaxed_item.."_outer", {_mcl_waxed_variant = waxed_item.."_outer"}) + elseif subname:find("slab") then + minetest.override_item(waxed_item.."_double", {_mcl_stripped_variant = unwaxed_item.."_double"}) + minetest.override_item(waxed_item.."_top", {_mcl_stripped_variant = unwaxed_item.."_top"}) + minetest.override_item(unwaxed_item.."_double", {_mcl_waxed_variant = waxed_item.."_double"}) + minetest.override_item(unwaxed_item.."_top", {_mcl_waxed_variant = waxed_item.."_top"}) + elseif subname:find("trapdoor") then + minetest.override_item(waxed_item.."_open", {_mcl_stripped_variant = unwaxed_item.."_open"}) + minetest.override_item(unwaxed_item.."_open", {_mcl_waxed_variant = waxed_item.."_open"}) + elseif subname == "waxed_door" then + minetest.override_item(waxed_item.."_b_1", {_mcl_stripped_variant = unwaxed_item.."_b_1"}) + minetest.override_item(unwaxed_item.."_b_1", {_mcl_waxed_variant = waxed_item.."_b_1"}) + minetest.override_item(waxed_item.."_t_1", {_mcl_stripped_variant = unwaxed_item.."_t_1"}) + minetest.override_item(unwaxed_item.."_t_1", {_mcl_waxed_variant = waxed_item.."_t_1"}) - -- slab - def = "mcl_stairs:slab_" .. waxed_variants[i][1] - def_variant_scraped = "mcl_stairs:slab_" .. waxed_variants[i][2] - minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) + minetest.override_item(waxed_item.."_b_2", {_mcl_stripped_variant = unwaxed_item.."_b_2"}) + minetest.override_item(unwaxed_item.."_b_2", {_mcl_waxed_variant = waxed_item.."_b_2"}) + minetest.override_item(waxed_item.."_t_2", {_mcl_stripped_variant = unwaxed_item.."_t_2"}) + minetest.override_item(unwaxed_item.."_t_2", {_mcl_waxed_variant = waxed_item.."_t_2"}) - def = "mcl_stairs:slab_" .. waxed_variants[i][1] .. "_top" - def_variant_scraped = "mcl_stairs:slab_" .. waxed_variants[i][2] .. "_top" - minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) - - def = "mcl_stairs:slab_" .. waxed_variants[i][1] .. "_double" - def_variant_scraped = "mcl_stairs:slab_" .. waxed_variants[i][2] .. "_double" - minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) + minetest.override_item(waxed_item.."_b_3", {_mcl_stripped_variant = unwaxed_item.."_b_3"}) + minetest.override_item(unwaxed_item.."_b_3", {_mcl_waxed_variant = waxed_item.."_b_3"}) + minetest.override_item(waxed_item.."_t_3", {_mcl_stripped_variant = unwaxed_item.."_t_3"}) + minetest.override_item(unwaxed_item.."_t_3", {_mcl_waxed_variant = waxed_item.."_t_3"}) + minetest.override_item(waxed_item.."_b_4", {_mcl_stripped_variant = unwaxed_item.."_b_4"}) + minetest.override_item(unwaxed_item.."_b_4", {_mcl_waxed_variant = waxed_item.."_b_4"}) + minetest.override_item(waxed_item.."_t_4", {_mcl_stripped_variant = unwaxed_item.."_t_4"}) + minetest.override_item(unwaxed_item.."_t_4", {_mcl_waxed_variant = waxed_item.."_t_4"}) + end + end end --- Waxed Oxidized Slabs and Stairs -local oxidized_slabs = { - "oxidized_cut", - "oxidized_cut_double", - "oxidized_cut_top" +local cut_decay_chain = { + "_cut", + "_exposed_cut", + "_weathered_cut", + "_oxidized_cut" +} +local doors_decay_chain = { + "", + "_exposed", + "_weathered", + "_oxidized" } -for i = 1, #oxidized_slabs do - def = "mcl_stairs:slab_copper_" .. oxidized_slabs[i] - def_variant_waxed = "mcl_stairs:slab_waxed_copper_" .. oxidized_slabs[i] - minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed }) -end - -local oxidized_stairs = { - "oxidized_cut", - "oxidized_cut_inner", - "oxidized_cut_outer" -} - -for i = 1, #oxidized_stairs do - def = "mcl_stairs:stair_copper_" .. oxidized_stairs[i] - def_variant_waxed = "mcl_stairs:stair_waxed_copper_" .. oxidized_stairs[i] - minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed }) -end +mcl_copper.register_oxidation_and_scraping("mcl_stairs", "stair_copper", cut_decay_chain) +mcl_copper.register_oxidation_and_scraping("mcl_stairs", "slab_copper", cut_decay_chain) +mcl_copper.register_oxidation_and_scraping("mcl_copper", "trapdoor", doors_decay_chain) +mcl_copper.register_oxidation_and_scraping("mcl_copper", "door", doors_decay_chain) +mcl_copper.register_waxing_and_scraping("mcl_stairs", "stair_waxed_copper", cut_decay_chain) +mcl_copper.register_waxing_and_scraping("mcl_stairs", "slab_waxed_copper", cut_decay_chain) +mcl_copper.register_waxing_and_scraping("mcl_copper", "waxed_trapdoor", doors_decay_chain) +mcl_copper.register_waxing_and_scraping("mcl_copper", "waxed_door", doors_decay_chain) diff --git a/mods/ITEMS/mcl_copper/init.lua b/mods/ITEMS/mcl_copper/init.lua index 01ece6d54..e300f9143 100644 --- a/mods/ITEMS/mcl_copper/init.lua +++ b/mods/ITEMS/mcl_copper/init.lua @@ -2,6 +2,7 @@ local path = minetest.get_modpath("mcl_copper") mcl_copper = {} -- initialize global variable. +dofile(path .. "/descriptions.lua") dofile(path .. "/nodes.lua") dofile(path .. "/items.lua") dofile(path .. "/crafting.lua") diff --git a/mods/ITEMS/mcl_copper/locale/mcl_copper.pt_BR.tr b/mods/ITEMS/mcl_copper/locale/mcl_copper.pt_BR.tr index 18aeb1304..a5007c209 100644 --- a/mods/ITEMS/mcl_copper/locale/mcl_copper.pt_BR.tr +++ b/mods/ITEMS/mcl_copper/locale/mcl_copper.pt_BR.tr @@ -55,3 +55,62 @@ Waxed Weathered Copper=Cobre Desgastado Encerado Weathered cut copper is a decorative block.=Cobre lapidado desgastado é um bloco decorativo. Weathered Cut Copper=Cobre Lapidado Desgastado Waxed Weathered Cut Copper=Cobre Lapidado Desgastado Encerado +Copper Grate=Grade de Cobre +Waxed Copper Grate=Grade de Cobre Encerada +Copper grate is a decorative block.=Grade de cobre é um bloco decorativo. +Exposed Copper Grate=Grade de Cobre Exposto +Waxed Exposed Copper Grate=Grade de Cobre Exposto Encerada +Exposed copper grate is a decorative block.=Grade de cobre exposto é um bloco decorativo. +Weathered Copper Grate=Grade de Cobre Desgastado +Waxed Weathered Copper Grate=Grade de Cobre Desgastado Encerada +Weathered opper grate is a decorative block.=Grade de cobre de desgastado é um bloco decorativo. +Oxidized Copper Grate=Grade de Cobre Oxidado +Waxed Oxidized Copper Grate=Grade de Cobre Oxidado Encerada +Oxidized copper grate is a decorative block.=Grade de cobre oxidado é um bloco decorativo. +Chiseled Copper=Cobre Talhado +Waxed Chiseled Copper=Cobre Talhado Encerado +Chiseled copper is a decorative block.=Cobre talhado é um bloco decorativo. +Exposed Chiseled Copper=Cobre Talhado Exposto +Waxed Exposed Chiseled Copper=Cobre Talhado Exposto Encerado +Exposed chiseled copper is a decorative block.=Cobre talhado exposto é um bloco decorativo. +Weathered Chiseled Copper=Cobre Talhado Desgastado +Waxed Weathered Chiseled Copper=Cobre Talhado Desgastado Encerado +Weathered chiseled copper is a decorative block.=Cobre talhado desgastado é um bloco decorativo. +Oxidized Chiseled Copper=Cobre Talhado Oxidado +Waxed Oxidized Chiseled Copper=Cobre Talhado Oxidado Encerado +Oxidized chiseled copper is a decorative block.=Cobre talhado oxidado é um bloco decorativo. +Copper Bulb=Bulbo de Cobre +Waxed Copper Bulb=Bulbo de Cobre Encerado +Copper bulb is a decorative block and a light source.=Bulbo de cobre é um bloco decorativo e uma fonte de luz. +Copper bulb is a decorative block and a light source when lited.=Bulbo de cobre é um bloco decorativo e uma fonte de luz quando aceso. +Exposed Copper Bulb=Bulbo de Cobre Exposto +Waxed Exposed Copper Bulb=Bulbo de Cobre Exposto Encerado +Exposed copper bulb is a decorative block and a light source.=Bulbo de cobre exposto é um bloco decorativo e uma fonte de luz. +Exposed copper bulb is a decorative block and a light source when lited.=Bulbo de cobre exposto é um bloco decorativo e uma fonte de luz quando aceso. +Weathered Copper Bulb=Bulbo de Cobre Desgastado +Waxed Weathered Copper Bulb=Bulbo de Cobre Desgastado Encerado +Weathered copper bulb is a decorative block and a light source.=Bulbo de cobre desgastado é um bloco decorativo e uma fonte de luz. +Weathered copper bulb is a decorative block and a light source when lited.=Bulbo de cobre desgastado é um bloco decorativo e uma fonte de luz quando aceso. +Oxidized Copper Bulb=Bulbo de Cobre Oxidado +Waxed Oxidized Copper Bulb=Bulbo de Cobre Oxidado Encerado +Oxidized copper bulb is a decorative block and a light source.=Bulbo de cobre oxidado é um bloco decorativo e uma fonte de luz. +Oxidized copper bulb is a decorative block and a light source when lited.=Bulbo de cobre oxidado é um bloco decorativo e uma fonte de luz quando aceso. +Copper Door=Porta de Cobre +Waxed Copper Door=Porta de Cobre Encerada +Exposed Copper Door=Porta de Cobre Exposto +Waxed Exposed Copper Door=Porta de Cobre Exposto Encerada +Weathered Copper Door=Porta de Cobre Desgastado +Waxed Weathered Copper Door=Porta de Cobre Desgastado Encerada +Oxidized Copper Door=Porta de Cobre Oxidado +Waxed Oxidized Copper Door=Porta de Cobre Oxidado Encerada +Copper Trapdoor=Alçapão de Cobre +Waxed Copper Trapdoor=Alçapão de Cobre Encerado +Exposed Copper Trapdoor=Alçapão de Cobre Exposto +Waxed Exposed Copper Trapdoor=Alçapão de Cobre Exposto Encerado +Weathered Copper Trapdoor=Alçapão de Cobre Desgastado +Waxed Weathered Copper Trapdoor=Alçapão de Cobre Desgastado Encerado +Oxidized Copper Trapdoor=Alçapão de Cobre Oxidado +Waxed Oxidized Copper Trapdoor=Alçapão de Cobre Oxidado Encerado +@1 (Lit)=@1 (Aceso) +@1 (Powered)=@1 (Energizado) +@1 (Lit and Powered)=@1 (Aceso e Energizado) diff --git a/mods/ITEMS/mcl_copper/locale/template.txt b/mods/ITEMS/mcl_copper/locale/template.txt index 7022780ff..cca2eb983 100644 --- a/mods/ITEMS/mcl_copper/locale/template.txt +++ b/mods/ITEMS/mcl_copper/locale/template.txt @@ -55,3 +55,62 @@ Waxed Weathered Copper= Weathered cut copper is a decorative block.= Weathered Cut Copper= Waxed Weathered Cut Copper= +Copper Grate= +Waxed Copper Grate= +Copper grate is a decorative block.= +Exposed Copper Grate= +Waxed Exposed Copper Grate= +Exposed copper grate is a decorative block.= +Weathered Copper Grate= +Waxed Weathered Copper Grate= +Weathered copper grate is a decorative block.= +Oxidized Copper Grate= +Waxed Oxidized Copper Grate= +Oxidized copper grate is a decorative block.= +Chiseled Copper= +Waxed Chiseled Copper= +Chiseled copper is a decorative block.= +Exposed Chiseled Copper= +Waxed Exposed Chiseled Copper= +Exposed chiseled copper is a decorative block.= +Weathered Chiseled Copper= +Waxed Weathered Chiseled Copper= +Weathered chiseled copper is a decorative block.= +Oxidized Chiseled Copper= +Waxed Oxidized Chiseled Copper= +Oxidized chiseled copper is a decorative block.= +Copper Bulb= +Waxed Copper Bulb= +Copper bulb is a decorative block and a light source.= +Copper bulb is a decorative block and a light source when lited.= +Exposed Copper Bulb= +Waxed Exposed Copper Bulb= +Exposed copper bulb is a decorative block and a light source.= +Exposed copper bulb is a decorative block and a light source when lited.= +Weathered Copper Bulb= +Waxed Weathered Copper Bulb= +Weathered copper bulb is a decorative block and a light source.= +Weathered copper bulb is a decorative block and a light source when lited.= +Oxidized Copper Bulb= +Waxed Oxidized Copper Bulb= +Oxidized copper bulb is a decorative block and a light source.= +Oxidized copper bulb is a decorative block and a light source when lited.= +Copper Door= +Waxed Copper Door= +Exposed Copper Door= +Waxed Exposed Copper Door= +Weathered Copper Door= +Waxed Weathered Copper Door= +Oxidized Copper Door= +Waxed Oxidized Copper Door= +Copper Trapdoor= +Waxed Copper Trapdoor= +Exposed Copper Trapdoor= +Waxed Exposed Copper Trapdoor= +Weathered Copper Trapdoor= +Waxed Weathered Copper Trapdoor= +Oxidized Copper Trapdoor= +Waxed Oxidized Copper Trapdoor= +@1 (Lit)= +@1 (Powered)= +@1 (Lit and Powered)= diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index af5a49a1c..b8a5c218c 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -1,5 +1,191 @@ local S = minetest.get_translator("mcl_copper") +local function set_description(descs, s_index, n_index) + local description + + if type(descs[s_index][n_index]) == "string" then + description = S(descs[s_index][n_index]) + elseif type(descs[s_index][n_index]) == "table" then + description = S("@1 "..descs[s_index][n_index][2], S(descs[s_index][n_index][1])) + else + return nil + end + + return description +end + +local function set_drop(drop, old_name, index_name) + if drop and old_name and index_name then + drop = "mcl_copper:"..old_name:gsub(index_name, drop) + end + + return drop +end + +local function set_groups(name, groups) + local groups = table.copy(groups) + + if name and groups then + if name:find("waxed") then + groups.waxed = 1 + elseif not name:find("oxidized") then + groups.oxidizable = 1 + end + + if name:find("door") then + groups.building_block = 0 + groups.mesecon_effector_on = 1 + end + else + return nil + end + + return groups +end + +local function set_light_level(light_source, index) + local ceil, floor_5, floor_7 = math.ceil(index / 2), math.floor(index / 5), math.floor(index / 7) + if light_source then + light_source = light_source - 3 * (ceil - 1) - floor_5 - floor_7 + end + + return light_source +end + +local function set_tiles(tiles, index) + if not tiles or not index then + return + end + + return tiles[math.ceil(index / 2)] +end + +function mcl_copper.register_copper_variants(name, definitions) + local names, oxidized_variant, stripped_variant, waxed_variant + + if name ~= "cut" then + names = { + name, "waxed_"..name, + name.."_exposed", "waxed_"..name.."_exposed", + name.."_weathered", "waxed_"..name.."_weathered", + name.."_oxidized", "waxed_"..name.."_oxidized" + } + else + names = { + "block_"..name, "waxed_block_"..name, + "block_exposed_"..name, "waxed_block_exposed_"..name, + "block_weathered_"..name, "waxed_block_weathered_"..name, + "block_oxidized_"..name, "waxed_block_oxidized_"..name + } + end + + local tiles = { + "mcl_copper_"..name..".png", + "mcl_copper_"..name.."_exposed.png", + "mcl_copper_"..name.."_weathered.png", + "mcl_copper_"..name.."_oxidized.png" + } + + for i = 1, #names do + if names[i]:find("waxed") then + stripped_variant = "mcl_copper:"..names[i-1] + else + if not names[i]:find("oxidized") then + oxidized_variant = "mcl_copper:"..names[i+2] + end + if i ~= 1 then + stripped_variant = "mcl_copper:"..names[i-2] + end + waxed_variant = "mcl_copper:"..names[i+1] + end + + minetest.register_node("mcl_copper:"..names[i], { + description = set_description(mcl_copper.copper_descs, name, i), + drawtype = definitions.drawtype or "normal", + drop = set_drop(definitions.drop, names[i], name), + groups = set_groups(names[i], definitions.groups), + is_ground_content = false, + light_source = set_light_level(definitions.light_source, i), + mesecons = definitions.mesecons, + paramtype = definitions.paramtype or "none", + paramtype2 = definitions.paramtype2 or "none", + sounds = mcl_sounds.node_sound_metal_defaults(), + sunlight_propagates = definitions.sunlight_propagates or false, + tiles = {set_tiles(tiles, i)}, + _doc_items_longdesc = S(mcl_copper.copper_longdescs[name][math.ceil(i/2)]), + _mcl_blast_resistance = 6, + _mcl_hardness = 3, + _mcl_oxidized_variant = oxidized_variant, + _mcl_stripped_variant = stripped_variant, + _mcl_waxed_variant = waxed_variant, + }) + + if definitions._mcl_stairs then + local subname = mcl_copper.stairs_subnames[name][i] + + mcl_stairs.register_slab(subname, "mcl_copper:"..names[i], set_groups(subname, definitions.groups), + {set_tiles(tiles, i), set_tiles(tiles, i), set_tiles(tiles, i)}, + set_description(mcl_copper.stairs_descs, subname, 1), nil, nil, nil, + set_description(mcl_copper.stairs_descs, subname, 2) + ) + + mcl_stairs.register_stair(subname, "mcl_copper:"..names[i], set_groups(subname, definitions.groups), + {set_tiles(tiles, i), set_tiles(tiles, i), set_tiles(tiles, i), + set_tiles(tiles, i), set_tiles(tiles, i), set_tiles(tiles, i)}, + set_description(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 = set_groups(names[i]:gsub(name, "door"), definitions.groups) + local trapdoor_groups = set_groups(names[i]:gsub(name, "trapdoor"), definitions.groups) + + 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 + minetest.register_node("mcl_copper:stone_with_copper", { description = S("Copper Ore"), _doc_items_longdesc = S("Some copper contained in stone, it is pretty common and can be found below sea level."), @@ -17,326 +203,82 @@ minetest.register_node("mcl_copper:stone_with_copper", { minetest.register_node("mcl_copper:block_raw", { description = S("Block of Raw Copper"), _doc_items_longdesc = S("A block used for compact raw copper storage."), - tiles = {"mcl_copper_block_raw.png"}, + tiles = {"mcl_copper_raw_block.png"}, is_ground_content = false, - groups = {pickaxey = 2, building_block = 1, blast_furnace_smeltable = 1 }, + groups = {pickaxey = 2, building_block = 1, blast_furnace_smeltable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, }) -minetest.register_node("mcl_copper:block", { - description = S("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, oxidizable = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 3, - _mcl_oxidized_variant = "mcl_copper:block_exposed", - _mcl_waxed_variant = "mcl_copper:waxed_block", -}) - -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, waxed = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 3, - _mcl_stripped_variant = "mcl_copper:block", -}) - -minetest.register_node("mcl_copper:block_exposed", { - description = S("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, oxidizable = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_oxidized_variant = "mcl_copper:block_weathered", - _mcl_waxed_variant = "mcl_copper:waxed_block_exposed", - _mcl_stripped_variant = "mcl_copper:block", -}) - -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, waxed = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_exposed", -}) - -minetest.register_node("mcl_copper:block_weathered", { - description = S("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, oxidizable = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_oxidized_variant = "mcl_copper:block_oxidized", - _mcl_waxed_variant = "mcl_copper:waxed_block_weathered", - _mcl_stripped_variant = "mcl_copper:block_exposed", -}) - -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, waxed = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_weathered", -}) - -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, +mcl_copper.register_copper_variants("block", { groups = {pickaxey = 2, building_block = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_waxed_variant = "mcl_copper:waxed_block_oxidized", - _mcl_stripped_variant = "mcl_copper:block_weathered", + _mcl_doors = true, }) -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, waxed = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_oxidized", -}) - -minetest.register_node("mcl_copper:block_cut", { - description = S("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, oxidizable = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_oxidized_variant = "mcl_copper:block_exposed_cut", - _mcl_waxed_variant = "mcl_copper:waxed_block_cut", -}) - -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, waxed = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_cut", -}) - -minetest.register_node("mcl_copper:block_exposed_cut", { - description = S("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, oxidizable = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_waxed_variant = "mcl_copper:waxed_block_exposed_cut", - _mcl_oxidized_variant = "mcl_copper:block_weathered_cut", - _mcl_stripped_variant = "mcl_copper:block_cut", -}) - -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, waxed = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_exposed_cut", -}) - -minetest.register_node("mcl_copper:block_weathered_cut", { - description = S("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, oxidizable = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_exposed_cut", - _mcl_oxidized_variant = "mcl_copper:block_oxidized_cut", - _mcl_waxed_variant = "mcl_copper:waxed_block_weathered_cut", -}) - -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, waxed = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_weathered_cut", -}) - -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, +mcl_copper.register_copper_variants("cut", { groups = {pickaxey = 2, building_block = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_weathered_cut", - _mcl_waxed_variant = "mcl_copper:waxed_block_oxidized_cut", + _mcl_stairs = true, +}) +--[[ +mcl_copper.register_copper_variants("grate", { + drawtype = "allfaces", + groups = {pickaxey = 2, building_block = 1, disable_suffocation = 1}, + sunlight_propagates = true, }) -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, waxed = 1}, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_oxidized_cut", +mcl_copper.register_copper_variants("chiseled", { + groups = {pickaxey = 2, building_block = 1} }) -mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut", - {pickaxey = 2, oxidizable = 1}, - {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"}, - S("Slab of Cut Copper"), - nil, nil, nil, - S("Double Slab of Cut Copper")) +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_stairs.register_slab("waxed_copper_cut", "mcl_copper:waxed_block_cut", - {pickaxey = 2, waxed = 1}, - {"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_copper.register_copper_variants("bulb_on", { + drop = "bulb_off", + 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_stairs.register_slab("copper_exposed_cut", "mcl_copper:block_exposed_cut", - {pickaxey = 2, oxidizable = 1}, - {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, - S("Slab of Exposed Cut Copper"), - nil, nil, nil, - S("Double Slab of Exposed Cut Copper")) +mcl_copper.register_copper_variants("bulb_powered_off", { + drop = "bulb_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_stairs.register_slab("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", - {pickaxey = 2, waxed = 1}, - {"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("Waxed Double Slab of Exposed Cut Copper")) - -mcl_stairs.register_slab("copper_weathered_cut", "mcl_copper:block_weathered_cut", - {pickaxey = 2, oxidizable = 1}, - {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"}, - S("Slab of Weathered Cut Copper"), - 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, waxed = 1}, - {"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, waxed = 1}, - {"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, oxidizable = 1}, - {"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("Stairs of Cut Copper"), - nil, 6, nil, - "woodlike") - -mcl_stairs.register_stair("waxed_copper_cut", "mcl_copper:waxed_block_cut", - {pickaxey = 2, waxed = 1}, - {"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, oxidizable = 1}, - {"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("Stairs of Exposed Cut Copper"), - nil, 6, nil, - "woodlike") - -mcl_stairs.register_stair("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", - {pickaxey = 2, waxed = 1}, - {"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") - -mcl_stairs.register_stair("copper_weathered_cut", "mcl_copper:block_weathered_cut", - {pickaxey = 2, oxidizable = 1}, - {"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") - -mcl_stairs.register_stair("waxed_copper_weathered_cut", "mcl_copper:waxed_block_weathered_cut", - {pickaxey = 2, waxed = 1}, - {"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, waxed = 1}, - {"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") +mcl_copper.register_copper_variants("bulb_powered_on", { + drop = "bulb_off", + 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" +}) +]] diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index a870e7c08..38ef3254f 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -8,22 +8,35 @@ local S = minetest.get_translator(minetest.get_current_modname()) local alldirs = { { x = 0, y = 0, z = 1 }, { x = 1, y = 0, z = 0 }, { x = 0, y = 0, z = -1 }, { x = -1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 }, { x = 0, y = 1, z = 0 } } -- Waxing Function -function mcl_honey.wax_block(pos, node, player, itemstack) +function mcl_honey.wax_block(pos, node, player, itemstack, pointed_thing) -- prevent modification of protected nodes. if mcl_util.check_position_protection(pos, player) then return end local def = minetest.registered_nodes[node.name] - - if def and def._mcl_waxed_variant then - node.name = def._mcl_waxed_variant + if player:get_player_control().sneak then + if def and def._mcl_waxed_variant then + if def.groups.door == 1 then + if node.name:find("_b_") then + local top_pos = { x = pos.x, y = pos.y + 1, z = pos.z } + minetest.swap_node(top_pos, { name = def._mcl_waxed_variant:gsub("_b_", "_t_"), param2 = node.param2 }) + elseif node.name:find("_t_") then + local bot_pos = { x = pos.x, y = pos.y - 1, z = pos.z } + minetest.swap_node(bot_pos, { name = def._mcl_waxed_variant:gsub("_t_", "_b_"), param2 = node.param2 }) + end + end + else + return + end else - return + if def and def.on_rightclick then + return def.on_rightclick(pos, node, player, itemstack, pointed_thing) + end end node.name = def._mcl_waxed_variant - minetest.set_node(pos, node) + minetest.swap_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() @@ -46,7 +59,7 @@ minetest.register_craftitem("mcl_honey:honeycomb", { local pos = pointed_thing.under -- wax the block. This is the only viable usage of honeycomb's on_place. If it "fails" to wax, then nothing is changed. - return mcl_honey.wax_block(pos, node, placer, itemstack) + return mcl_honey.wax_block(pos, node, placer, itemstack, pointed_thing) end, }) diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index 6282da5c3..a4f5c45ca 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -410,6 +410,16 @@ local function make_stripped_trunk(itemstack, placer, pointed_thing) if noddef._mcl_stripped_variant == nil then return itemstack else + if noddef.groups.door == 1 then + local pt_under = pointed_thing.under + if node_name:find("_b_") then + local top_pos = {x = pt_under.x, y = pt_under.y + 1, z = pt_under.z} + minetest.swap_node(top_pos, {name=noddef._mcl_stripped_variant:gsub("_b_", "_t_"), param2=node.param2}) + elseif node_name:find("_t_") then + local bot_pos = {x = pt_under.x, y = pt_under.y - 1, z = pt_under.z} + minetest.swap_node(bot_pos, {name=noddef._mcl_stripped_variant:gsub("_t_", "_b_"), param2=node.param2}) + end + end minetest.swap_node(pointed_thing.under, {name=noddef._mcl_stripped_variant, param2=node.param2}) if minetest.get_item_group(node_name, "waxed") ~= 0 then awards.unlock(placer:get_player_name(), "mcl:wax_off")