From 4b9fc7046bcc09f8980d8f27a6ca4e84fc27cdd4 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Fri, 19 May 2023 20:24:13 -0600 Subject: [PATCH 1/7] Add Oxidization API --- mods/CORE/mcl_oxidation/README.md | 14 +++++++++++++ mods/CORE/mcl_oxidation/init.lua | 12 +++++++++++ mods/CORE/mcl_oxidation/mod.conf | 4 ++++ mods/ITEMS/mcl_copper/functions.lua | 12 ----------- mods/ITEMS/mcl_copper/nodes.lua | 32 ++++++++++++++--------------- 5 files changed, 46 insertions(+), 28 deletions(-) create mode 100644 mods/CORE/mcl_oxidation/README.md create mode 100644 mods/CORE/mcl_oxidation/init.lua create mode 100644 mods/CORE/mcl_oxidation/mod.conf diff --git a/mods/CORE/mcl_oxidation/README.md b/mods/CORE/mcl_oxidation/README.md new file mode 100644 index 000000000..70d9c24fe --- /dev/null +++ b/mods/CORE/mcl_oxidation/README.md @@ -0,0 +1,14 @@ +# Oxidization API for MineClone 2 +This mods adds the oxidization api, so that modders can easily use the same features that copper uses. + +## API +To take advantage of the actual oxidization, put `oxidizable = 1` into the list of groups for the oxidizable node. +You would also need to put `_mcl_oxidized_variant = itemstring of node this node will oxidize into` into the node definition. +For example, a copper block oxidizes into exposed copper, so the defintion would be `_mcl_oxidized_variant = "mcl_copper:block_exposed"`. + +To utilize the ability to wax the block for protection from oxidization, put `mcl_waxed_varient = item string of waxed varient of node` into the node definition table. +For example, Copper Blocks have the definition arguement of `_mcl_waxed_variant = "mcl_copper:waxed_block"`. + +For waxed nodes, scraping is easy. Start by putting `waxed = 1` into the list of groups of the waxed node. +Next put `_mcl_stripped_variant = item string of the unwaxed varient of the node` into the defintion table. +Wxaed Copper Blocks can be scrapped into normal Copper Blocks because of the definition `_mcl_stripped_variant = "mcl_copper:block"`. diff --git a/mods/CORE/mcl_oxidation/init.lua b/mods/CORE/mcl_oxidation/init.lua new file mode 100644 index 000000000..f0e8a37e6 --- /dev/null +++ b/mods/CORE/mcl_oxidation/init.lua @@ -0,0 +1,12 @@ +minetest.register_abm({ + label = "Oxidatize Nodes", + nodenames = { "group:oxidizable" }, + interval = 500, + chance = 3, + action = function(pos, node) + local def = minetest.registered_nodes[node] + if def and def._mcl_oxidized_variant then + minetest.swap_node(pos, { name = def._mcl_oxidized_varient, param2 = node.param2 }) + end + end, +}) diff --git a/mods/CORE/mcl_oxidation/mod.conf b/mods/CORE/mcl_oxidation/mod.conf new file mode 100644 index 000000000..7ab7eeffe --- /dev/null +++ b/mods/CORE/mcl_oxidation/mod.conf @@ -0,0 +1,4 @@ +name = mcl_oxidation +title = Oxidation API for MineClone 2 +author = PrairieWind, N011, Michael +description = API to allow oxidizing different nodes. diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index db756e425..8410526ac 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -1,17 +1,5 @@ --local deepslate_mod = minetest.get_modpath("mcl_deepslate") -local function register_oxidation_abm(abm_name, node_name, oxidized_variant) - minetest.register_abm({ - label = abm_name, - nodenames = { node_name }, - interval = 500, - chance = 3, - action = function(pos, node) - minetest.swap_node(pos, { name = oxidized_variant, param2 = node.param2 }) - end, - }) -end - --[[ local stairs = { {"stair", "exposed", "_inner", "cut_inner"}, diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index c8bb139cf..4bf5fd534 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -30,7 +30,7 @@ minetest.register_node("mcl_copper:block", { _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}, + groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 3, @@ -54,7 +54,7 @@ minetest.register_node("mcl_copper:block_exposed", { _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}, + groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -79,7 +79,7 @@ minetest.register_node("mcl_copper:block_weathered", { _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}, + groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -104,7 +104,7 @@ minetest.register_node("mcl_copper:block_oxidized", { _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}, + groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -129,7 +129,7 @@ minetest.register_node("mcl_copper:block_cut", { _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}, + groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -153,7 +153,7 @@ minetest.register_node("mcl_copper:block_exposed_cut", { _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}, + groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -178,7 +178,7 @@ minetest.register_node("mcl_copper:block_weathered_cut", { _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}, + groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -203,7 +203,7 @@ minetest.register_node("mcl_copper:block_oxidized_cut", { _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}, + groups = {pickaxey = 2, building_block = 1, oxidizable = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -224,7 +224,7 @@ minetest.register_node("mcl_copper:waxed_block_oxidized_cut", { }) mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut", - {pickaxey = 2}, + {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, @@ -238,7 +238,7 @@ mcl_stairs.register_slab("waxed_copper_cut", "mcl_copper:waxed_block_cut", S("Waxed Double Slab of Cut Copper")) mcl_stairs.register_slab("copper_exposed_cut", "mcl_copper:block_exposed_cut", - {pickaxey = 2}, + {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, @@ -252,7 +252,7 @@ mcl_stairs.register_slab("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exp S("Waxed Double Slab of Exposed Cut Copper")) mcl_stairs.register_slab("copper_weathered_cut", "mcl_copper:block_weathered_cut", - {pickaxey = 2}, + {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, @@ -266,7 +266,7 @@ mcl_stairs.register_slab("waxed_copper_weathered_cut", "mcl_copper:waxed_block_w S("Waxed Double Slab of Weathered Cut Copper")) mcl_stairs.register_slab("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", - {pickaxey = 2}, + {pickaxey = 2, oxidizable = 1}, {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, S("Slab of Oxidized Cut Copper"), nil, nil, nil, @@ -280,7 +280,7 @@ mcl_stairs.register_slab("waxed_copper_oxidized_cut", "mcl_copper:waxed_block_ox S("Waxed Double Slab of Oxidized Cut Copper")) mcl_stairs.register_stair("copper_cut", "mcl_copper:block_cut", - {pickaxey = 2}, + {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, @@ -294,7 +294,7 @@ mcl_stairs.register_stair("waxed_copper_cut", "mcl_copper:waxed_block_cut", "woodlike") mcl_stairs.register_stair("copper_exposed_cut", "mcl_copper:block_exposed_cut", - {pickaxey = 2}, + {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, @@ -308,7 +308,7 @@ mcl_stairs.register_stair("waxed_copper_exposed_cut", "mcl_copper:waxed_block_ex "woodlike") mcl_stairs.register_stair("copper_weathered_cut", "mcl_copper:block_weathered_cut", - {pickaxey = 2}, + {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, @@ -322,7 +322,7 @@ mcl_stairs.register_stair("waxed_copper_weathered_cut", "mcl_copper:waxed_block_ "woodlike") mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", - {pickaxey = 2}, + {pickaxey = 2, oxidizable = 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("Stairs of Oxidized Cut Copper"), nil, 6, nil, From 9e5a45e3fd991f2a7be1094e3c39df4011117457 Mon Sep 17 00:00:00 2001 From: Michieal Date: Wed, 15 Feb 2023 13:41:43 -0500 Subject: [PATCH 2/7] Rebased; Changed the way that the abm handles being called. Still have to make the scraped variants of the stairs & slabs. --- mods/ITEMS/mcl_copper/functions.lua | 57 ++++++++++++++++++++--------- mods/ITEMS/mcl_copper/nodes.lua | 6 +++ 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index 8410526ac..c3b97fd4c 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -32,32 +32,55 @@ local block_oxidation = { } local stair_oxidation = { - { "slab", "cut", "exposed_cut" }, - { "slab", "exposed_cut", "weathered_cut" }, - { "slab", "weathered_cut", "oxidized_cut" }, - { "slab", "cut_top", "exposed_cut_top" }, - { "slab", "exposed_cut_top", "weathered_cut_top" }, - { "slab", "weathered_cut_top", "oxidized_cut_double" }, - { "slab", "cut_double", "exposed_cut_double" }, - { "slab", "exposed_cut_double", "weathered_cut_double" }, - { "slab", "weathered_cut_double", "oxidized_cut_double" }, { "stair", "cut", "exposed_cut" }, - { "stair", "exposed_cut", "weathered_cut" }, - { "stair", "weathered_cut", "oxidized_cut" }, { "stair", "cut_inner", "exposed_cut_inner" }, - { "stair", "exposed_cut_inner", "weathered_cut_inner" }, - { "stair", "weathered_cut_inner", "oxidized_cut_inner" }, { "stair", "cut_outer", "exposed_cut_outer" }, + { "stair", "exposed_cut", "weathered_cut" }, + { "stair", "exposed_cut_inner", "weathered_cut_inner" }, { "stair", "exposed_cut_outer", "weathered_cut_outer" }, + { "stair", "weathered_cut", "oxidized_cut" }, + { "stair", "weathered_cut_inner", "oxidized_cut_inner" }, { "stair", "weathered_cut_outer", "oxidized_cut_outer" } } +local slab_oxidization = { + { "slab", "cut", "exposed_cut" }, + { "slab", "cut_top", "exposed_cut_top" }, + { "slab", "cut_double", "exposed_cut_double" }, + { "slab", "exposed_cut", "weathered_cut" }, + { "slab", "exposed_cut_top", "weathered_cut_top" }, + { "slab", "exposed_cut_double", "weathered_cut_double" }, + { "slab", "weathered_cut", "oxidized_cut" }, + { "slab", "weathered_cut_top", "oxidized_cut_double" }, + { "slab", "weathered_cut_double", "oxidized_cut_double" }, +} + for _, b in pairs(block_oxidation) do - register_oxidation_abm("Copper oxidation", "mcl_copper:block" .. b[1], "mcl_copper:block" .. b[2]) + register_oxidation_abm("mcl_copper:block" .. b[1]) end +local def +local def_variant_oxidized +local def_variant_waxed +-- local def_variant_scraped + for _, s in pairs(stair_oxidation) do - register_oxidation_abm("Copper oxidation", "mcl_stairs:" .. s[1] .. "_copper_" .. s[2], "mcl_stairs:" .. s[1] .. "_copper_" .. s[3]) - -- TODO: Make stairs and slabs be waxable / scrapable. Place the Node overrides here, just like they are on the copper nodes, and it will work properly. May need to update mcl_honey to call the waxing function for stairs and slabs. -end + register_oxidation_abm("Copper oxidation", "mcl_stairs:" .. s[1] .. "_copper_" .. s[2]) + def = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] + def_variant_oxidized = "mcl_stairs:" .. s[1] .. "_copper_" .. s[3] + minetest.override_item(def, { _mcl_oxidized_variant = def_variant_oxidized }) + + def_variant_waxed = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] .. "_waxed" + minetest.override_item(def, { _mcl_copper_waxed_variant = def_variant_waxed }) +end +for _, s in pairs(slab_oxidization) do + register_oxidation_abm("Copper oxidation", "mcl_stairs:" .. s[1] .. "_copper_" .. s[2]) + def = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] + def_variant_oxidized = "mcl_stairs:" .. s[1] .. "_copper_" .. s[3] + minetest.override_item(def, { _mcl_oxidized_variant = def_variant_oxidized }) + + def_variant_waxed = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] .. "_waxed" + minetest.override_item(def, { _mcl_copper_waxed_variant = def_variant_waxed }) +end +-- TODO: Do Scraped (mcl_stripped_variant) for stairs and slabs. diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index 4bf5fd534..b4768e4cc 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -34,6 +34,7 @@ minetest.register_node("mcl_copper:block", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 3, + _mcl_oxidized_variant = "mcl_copper:block_exposed", _mcl_copper_waxed_variant = "mcl_copper:waxed_block", }) @@ -58,6 +59,7 @@ minetest.register_node("mcl_copper:block_exposed", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, + _mcl_oxidized_variant = "mcl_copper:block_weathered", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_exposed", _mcl_stripped_variant = "mcl_copper:block", }) @@ -83,6 +85,7 @@ minetest.register_node("mcl_copper:block_weathered", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, + _mcl_oxidized_variant = "mcl_copper:block_oxidized", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered", _mcl_stripped_variant = "mcl_copper:block_exposed", }) @@ -133,6 +136,7 @@ minetest.register_node("mcl_copper:block_cut", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, + _mcl_oxidized_variant = "mcl_copper:block_cut_exposed", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_cut", }) @@ -158,6 +162,7 @@ minetest.register_node("mcl_copper:block_exposed_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_copper_waxed_variant = "mcl_copper:waxed_block_exposed_cut", + _mcl_oxidized_variant = "mcl_copper:block_cut_weathered", _mcl_stripped_variant = "mcl_copper:block_cut", }) @@ -183,6 +188,7 @@ minetest.register_node("mcl_copper:block_weathered_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block_exposed_cut", + _mcl_oxidized_variant = "mcl_copper:block_cut_oxidized", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered_cut", }) From d6858b7e2a8f9f241a2a5379a9231ae8cb5691d9 Mon Sep 17 00:00:00 2001 From: Michieal Date: Wed, 15 Feb 2023 13:59:39 -0500 Subject: [PATCH 3/7] Made the scraped variants of the stairs & slabs. Cleaned up commented out code. --- mods/ITEMS/mcl_copper/functions.lua | 73 ++++++++++------------------- 1 file changed, 26 insertions(+), 47 deletions(-) diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index c3b97fd4c..6d4451484 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -1,36 +1,3 @@ ---local deepslate_mod = minetest.get_modpath("mcl_deepslate") - ---[[ -local stairs = { - {"stair", "exposed", "_inner", "cut_inner"}, - {"stair", "weathered", "_inner", "exposed_cut_inner"}, - {"stair", "exposed", "_outer", "cut_outer"}, - {"stair", "weathered", "_outer", "exposed_cut_outer"}, - {"stair", "oxidized", "_outer", "weathered_cut_outer"}, - {"stair", "oxidized", "_inner", "weathered_cut_inner"}, - {"slab", "exposed", "","cut"}, - {"slab", "oxidized", "","weathered_cut"}, - {"slab", "weathered", "","exposed_cut"}, - {"slab", "exposed", "_top","cut_top"}, - {"slab", "oxidized", "_top", "weathered_cut_top"}, - {"slab", "weathered", "_top","exposed_cut_top"}, - {"slab", "exposed", "_double","cut_double"}, - {"slab", "oxidized", "_double","weathered_cut_double"}, - {"slab", "weathered", "_double","exposed_cut_double"}, - {"stair", "exposed", "","cut"}, - {"stair", "oxidized", "", "weathered_cut"}, - {"stair", "weathered", "", "exposed_cut"}, -}]] - -local block_oxidation = { - { "", "_exposed" }, - { "_cut", "_exposed_cut" }, - { "_exposed", "_weathered" }, - { "_exposed_cut", "_weathered_cut" }, - { "_weathered", "_oxidized" }, - { "_weathered_cut", "_oxidized_cut" } -} - local stair_oxidation = { { "stair", "cut", "exposed_cut" }, { "stair", "cut_inner", "exposed_cut_inner" }, @@ -55,17 +22,19 @@ local slab_oxidization = { { "slab", "weathered_cut_double", "oxidized_cut_double" }, } -for _, b in pairs(block_oxidation) do - register_oxidation_abm("mcl_copper:block" .. b[1]) -end - local def local def_variant_oxidized local def_variant_waxed --- local def_variant_scraped +local def_variant_scraped +-- register abm, then set up oxidized and waxed variants. for _, s in pairs(stair_oxidation) do - register_oxidation_abm("Copper oxidation", "mcl_stairs:" .. s[1] .. "_copper_" .. s[2]) + def = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] + def_variant_oxidized = "mcl_stairs:" .. s[1] .. "_copper_" .. s[3] + minetest.override_item(def, { _mcl_oxidized_variant = def_variant_oxidized }) + + def_variant_waxed = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] .. "_waxed" + minetest.override_item(def, { _mcl_copper_waxed_variant = def_variant_waxed }) def = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] def_variant_oxidized = "mcl_stairs:" .. s[1] .. "_copper_" .. s[3] minetest.override_item(def, { _mcl_oxidized_variant = def_variant_oxidized }) @@ -73,14 +42,24 @@ for _, s in pairs(stair_oxidation) do def_variant_waxed = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] .. "_waxed" minetest.override_item(def, { _mcl_copper_waxed_variant = def_variant_waxed }) end -for _, s in pairs(slab_oxidization) do - register_oxidation_abm("Copper oxidation", "mcl_stairs:" .. s[1] .. "_copper_" .. s[2]) - def = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] - def_variant_oxidized = "mcl_stairs:" .. s[1] .. "_copper_" .. s[3] - minetest.override_item(def, { _mcl_oxidized_variant = def_variant_oxidized }) - def_variant_waxed = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] .. "_waxed" - minetest.override_item(def, { _mcl_copper_waxed_variant = def_variant_waxed }) +-- Set up scraped variants. +for i=1, #stair_oxidation do + if i > 3 then + def = "mcl_stairs:" .. stair_oxidation[i][1] .. "_copper_" .. stair_oxidation[i][2] + def_variant_scraped="mcl_stairs:" .. stair_oxidation[i-3][1] .. "_copper_" .. stair_oxidation[i-3][2] + minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) + def = "mcl_stairs:" .. slab_oxidization[i][1] .. "_copper_" .. slab_oxidization[i][2] + def_variant_scraped="mcl_stairs:" .. slab_oxidization[i-3][1] .. "_copper_" .. slab_oxidization[i-3][2] + minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) + end + if i>6 then + def = "mcl_stairs:" .. stair_oxidation[i][1] .. "_copper_" .. stair_oxidation[i][3] + def_variant_scraped="mcl_stairs:" .. stair_oxidation[i][1] .. "_copper_" .. stair_oxidation[i][2] + minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) + def = "mcl_stairs:" .. slab_oxidization[i][1] .. "_copper_" .. slab_oxidization[i][3] + def_variant_scraped="mcl_stairs:" .. slab_oxidization[i][1] .. "_copper_" .. slab_oxidization[i][2] + minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) + end end --- TODO: Do Scraped (mcl_stripped_variant) for stairs and slabs. From 7c4682695809ce63e2e60be05ce77232199e6f86 Mon Sep 17 00:00:00 2001 From: Michieal Date: Wed, 15 Feb 2023 14:55:41 -0500 Subject: [PATCH 4/7] Did what I should have done to begin with: changed _mcl_copper_waxed_variant to _mcl_waxed_variant so that it intuitively applies to more than just copper. --- mods/ITEMS/mcl_copper/functions.lua | 121 +++++++++++++++++++--------- mods/ITEMS/mcl_copper/init.lua | 2 +- mods/ITEMS/mcl_copper/mod.conf | 2 +- mods/ITEMS/mcl_copper/nodes.lua | 24 +++--- mods/ITEMS/mcl_honey/init.lua | 4 +- 5 files changed, 99 insertions(+), 54 deletions(-) diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index 6d4451484..43fee2db7 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -1,25 +1,25 @@ -local stair_oxidation = { - { "stair", "cut", "exposed_cut" }, - { "stair", "cut_inner", "exposed_cut_inner" }, - { "stair", "cut_outer", "exposed_cut_outer" }, - { "stair", "exposed_cut", "weathered_cut" }, - { "stair", "exposed_cut_inner", "weathered_cut_inner" }, - { "stair", "exposed_cut_outer", "weathered_cut_outer" }, - { "stair", "weathered_cut", "oxidized_cut" }, - { "stair", "weathered_cut_inner", "oxidized_cut_inner" }, - { "stair", "weathered_cut_outer", "oxidized_cut_outer" } +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" } } local slab_oxidization = { - { "slab", "cut", "exposed_cut" }, - { "slab", "cut_top", "exposed_cut_top" }, - { "slab", "cut_double", "exposed_cut_double" }, - { "slab", "exposed_cut", "weathered_cut" }, - { "slab", "exposed_cut_top", "weathered_cut_top" }, - { "slab", "exposed_cut_double", "weathered_cut_double" }, - { "slab", "weathered_cut", "oxidized_cut" }, - { "slab", "weathered_cut_top", "oxidized_cut_double" }, - { "slab", "weathered_cut_double", "oxidized_cut_double" }, + { "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_double" }, + { "weathered_cut_double", "oxidized_cut_double" }, } local def @@ -27,39 +27,82 @@ local def_variant_oxidized local def_variant_waxed local def_variant_scraped --- register abm, then set up oxidized and waxed variants. -for _, s in pairs(stair_oxidation) do - def = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] - def_variant_oxidized = "mcl_stairs:" .. s[1] .. "_copper_" .. s[3] +-- 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 }) - def_variant_waxed = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] .. "_waxed" - minetest.override_item(def, { _mcl_copper_waxed_variant = def_variant_waxed }) - def = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] - def_variant_oxidized = "mcl_stairs:" .. s[1] .. "_copper_" .. s[3] + def_variant_waxed = "mcl_stairs:stair_waxed_copper_" .. stair_oxidization[i][2] + minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed }) + + -- 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 }) - def_variant_waxed = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] .. "_waxed" - minetest.override_item(def, { _mcl_copper_waxed_variant = def_variant_waxed }) + 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_oxidation do +for i = 1, #stair_oxidization do + -- does both stairs and slabs. if i > 3 then - def = "mcl_stairs:" .. stair_oxidation[i][1] .. "_copper_" .. stair_oxidation[i][2] - def_variant_scraped="mcl_stairs:" .. stair_oxidation[i-3][1] .. "_copper_" .. stair_oxidation[i-3][2] + 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_oxidization[i][1] .. "_copper_" .. slab_oxidization[i][2] - def_variant_scraped="mcl_stairs:" .. slab_oxidization[i-3][1] .. "_copper_" .. slab_oxidization[i-3][2] + + 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_oxidation[i][1] .. "_copper_" .. stair_oxidation[i][3] - def_variant_scraped="mcl_stairs:" .. stair_oxidation[i][1] .. "_copper_" .. stair_oxidation[i][2] + 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_oxidization[i][1] .. "_copper_" .. slab_oxidization[i][3] - def_variant_scraped="mcl_stairs:" .. slab_oxidization[i][1] .. "_copper_" .. slab_oxidization[i][2] + + 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 }) 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" }, +} + +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 }) + + 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 }) + + 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 }) + + -- 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 }) + + 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 }) + +end + diff --git a/mods/ITEMS/mcl_copper/init.lua b/mods/ITEMS/mcl_copper/init.lua index 937d262e2..01ece6d54 100644 --- a/mods/ITEMS/mcl_copper/init.lua +++ b/mods/ITEMS/mcl_copper/init.lua @@ -2,7 +2,7 @@ local path = minetest.get_modpath("mcl_copper") mcl_copper = {} -- initialize global variable. -dofile(path .. "/functions.lua") dofile(path .. "/nodes.lua") dofile(path .. "/items.lua") dofile(path .. "/crafting.lua") +dofile(path .. "/functions.lua") diff --git a/mods/ITEMS/mcl_copper/mod.conf b/mods/ITEMS/mcl_copper/mod.conf index 8cf5fd579..a48ee56f7 100644 --- a/mods/ITEMS/mcl_copper/mod.conf +++ b/mods/ITEMS/mcl_copper/mod.conf @@ -1,4 +1,4 @@ name = mcl_copper author = NO11 -depends = mcl_core, mcl_sounds, mcl_stairs, mcl_util +depends = mcl_core, mcl_sounds, mcl_stairs, mcl_util, mcl_oxidation description = Adds Copper Ore, blocks and items. diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index b4768e4cc..66f42ff41 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -35,7 +35,7 @@ minetest.register_node("mcl_copper:block", { _mcl_blast_resistance = 6, _mcl_hardness = 3, _mcl_oxidized_variant = "mcl_copper:block_exposed", - _mcl_copper_waxed_variant = "mcl_copper:waxed_block", + _mcl_waxed_variant = "mcl_copper:waxed_block", }) minetest.register_node("mcl_copper:waxed_block", { @@ -60,7 +60,7 @@ minetest.register_node("mcl_copper:block_exposed", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_oxidized_variant = "mcl_copper:block_weathered", - _mcl_copper_waxed_variant = "mcl_copper:waxed_block_exposed", + _mcl_waxed_variant = "mcl_copper:waxed_block_exposed", _mcl_stripped_variant = "mcl_copper:block", }) @@ -86,7 +86,7 @@ minetest.register_node("mcl_copper:block_weathered", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_oxidized_variant = "mcl_copper:block_oxidized", - _mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered", + _mcl_waxed_variant = "mcl_copper:waxed_block_weathered", _mcl_stripped_variant = "mcl_copper:block_exposed", }) @@ -107,11 +107,11 @@ minetest.register_node("mcl_copper:block_oxidized", { _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, oxidizable = 1}, + groups = {pickaxey = 2, building_block = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_copper_waxed_variant = "mcl_copper:waxed_block_oxidized", + _mcl_waxed_variant = "mcl_copper:waxed_block_oxidized", _mcl_stripped_variant = "mcl_copper:block_weathered", }) @@ -137,7 +137,7 @@ minetest.register_node("mcl_copper:block_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_oxidized_variant = "mcl_copper:block_cut_exposed", - _mcl_copper_waxed_variant = "mcl_copper:waxed_block_cut", + _mcl_waxed_variant = "mcl_copper:waxed_block_cut", }) minetest.register_node("mcl_copper:waxed_block_cut", { @@ -161,7 +161,7 @@ minetest.register_node("mcl_copper:block_exposed_cut", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_copper_waxed_variant = "mcl_copper:waxed_block_exposed_cut", + _mcl_waxed_variant = "mcl_copper:waxed_block_exposed_cut", _mcl_oxidized_variant = "mcl_copper:block_cut_weathered", _mcl_stripped_variant = "mcl_copper:block_cut", }) @@ -189,7 +189,7 @@ minetest.register_node("mcl_copper:block_weathered_cut", { _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block_exposed_cut", _mcl_oxidized_variant = "mcl_copper:block_cut_oxidized", - _mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered_cut", + _mcl_waxed_variant = "mcl_copper:waxed_block_weathered_cut", }) minetest.register_node("mcl_copper:waxed_block_weathered_cut", { @@ -209,12 +209,12 @@ minetest.register_node("mcl_copper:block_oxidized_cut", { _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, oxidizable = 1}, + 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_copper_waxed_variant = "mcl_copper:waxed_block_oxidized_cut", + _mcl_waxed_variant = "mcl_copper:waxed_block_oxidized_cut", }) minetest.register_node("mcl_copper:waxed_block_oxidized_cut", { @@ -272,7 +272,7 @@ mcl_stairs.register_slab("waxed_copper_weathered_cut", "mcl_copper:waxed_block_w S("Waxed Double Slab of Weathered Cut Copper")) mcl_stairs.register_slab("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", - {pickaxey = 2, oxidizable = 1}, + {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, @@ -328,7 +328,7 @@ mcl_stairs.register_stair("waxed_copper_weathered_cut", "mcl_copper:waxed_block_ "woodlike") mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", - {pickaxey = 2, oxidizable = 1}, + {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, diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index e3b958a7d..54a431924 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -16,7 +16,9 @@ function mcl_honey.wax_block(pos, node, player, itemstack) local def = minetest.registered_nodes[node.name] - if not def or not def._mcl_copper_waxed_variant then + if def and def._mcl_waxed_variant then + node.name = def._mcl_waxed_variant + else return end From 0fba7eaed4ef4c90748f6e9d3b1599fce15cc00b Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Sat, 20 May 2023 09:59:28 -0600 Subject: [PATCH 5/7] Fix a few crashes, make the abm work, and revive the wax off advancement --- mods/CORE/mcl_oxidation/init.lua | 4 +-- mods/ITEMS/mcl_copper/functions.lua | 2 +- mods/ITEMS/mcl_copper/nodes.lua | 38 ++++++++++++++--------------- mods/ITEMS/mcl_honey/init.lua | 2 +- mods/ITEMS/mcl_tools/init.lua | 3 +++ 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/mods/CORE/mcl_oxidation/init.lua b/mods/CORE/mcl_oxidation/init.lua index f0e8a37e6..201d0260a 100644 --- a/mods/CORE/mcl_oxidation/init.lua +++ b/mods/CORE/mcl_oxidation/init.lua @@ -4,9 +4,9 @@ minetest.register_abm({ interval = 500, chance = 3, action = function(pos, node) - local def = minetest.registered_nodes[node] + local def = minetest.registered_nodes[node.name] if def and def._mcl_oxidized_variant then - minetest.swap_node(pos, { name = def._mcl_oxidized_varient, param2 = node.param2 }) + minetest.set_node(pos, { name = def._mcl_oxidized_variant, param2 = node.param2 }) end end, }) diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index 43fee2db7..0de387df4 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -34,7 +34,7 @@ for i = 1, #stair_oxidization do def_variant_oxidized = "mcl_stairs:stair_copper_" .. stair_oxidization[i][2] minetest.override_item(def, { _mcl_oxidized_variant = def_variant_oxidized }) - def_variant_waxed = "mcl_stairs:stair_waxed_copper_" .. stair_oxidization[i][2] + def_variant_waxed = "mcl_stairs:stair_waxed_copper_" .. stair_oxidization[i][1] minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed }) -- slabs diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index 66f42ff41..b8fa12e4d 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -43,7 +43,7 @@ minetest.register_node("mcl_copper:waxed_block", { _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}, + groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 3, @@ -69,7 +69,7 @@ minetest.register_node("mcl_copper:waxed_block_exposed", { _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}, + groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -95,7 +95,7 @@ minetest.register_node("mcl_copper:waxed_block_weathered", { _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}, + groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -120,7 +120,7 @@ minetest.register_node("mcl_copper:waxed_block_oxidized", { _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}, + groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -136,7 +136,7 @@ minetest.register_node("mcl_copper:block_cut", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_oxidized_variant = "mcl_copper:block_cut_exposed", + _mcl_oxidized_variant = "mcl_copper:block_exposed_cut", _mcl_waxed_variant = "mcl_copper:waxed_block_cut", }) @@ -145,7 +145,7 @@ minetest.register_node("mcl_copper:waxed_block_cut", { _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}, + groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -162,7 +162,7 @@ minetest.register_node("mcl_copper:block_exposed_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_waxed_variant = "mcl_copper:waxed_block_exposed_cut", - _mcl_oxidized_variant = "mcl_copper:block_cut_weathered", + _mcl_oxidized_variant = "mcl_copper:block_weathered_cut", _mcl_stripped_variant = "mcl_copper:block_cut", }) @@ -171,7 +171,7 @@ minetest.register_node("mcl_copper:waxed_block_exposed_cut", { _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}, + groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -188,7 +188,7 @@ minetest.register_node("mcl_copper:block_weathered_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block_exposed_cut", - _mcl_oxidized_variant = "mcl_copper:block_cut_oxidized", + _mcl_oxidized_variant = "mcl_copper:block_oxidized_cut", _mcl_waxed_variant = "mcl_copper:waxed_block_weathered_cut", }) @@ -197,7 +197,7 @@ minetest.register_node("mcl_copper:waxed_block_weathered_cut", { _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}, + groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -222,7 +222,7 @@ minetest.register_node("mcl_copper:waxed_block_oxidized_cut", { _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}, + groups = {pickaxey = 2, building_block = 1, waxed = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, @@ -237,7 +237,7 @@ mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut", S("Double Slab of Cut Copper")) mcl_stairs.register_slab("waxed_copper_cut", "mcl_copper:waxed_block_cut", - {pickaxey = 2}, + {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, @@ -251,7 +251,7 @@ mcl_stairs.register_slab("copper_exposed_cut", "mcl_copper:block_exposed_cut", S("Double Slab of Exposed Cut Copper")) mcl_stairs.register_slab("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", - {pickaxey = 2}, + {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, @@ -265,7 +265,7 @@ mcl_stairs.register_slab("copper_weathered_cut", "mcl_copper:block_weathered_cut S("Double Slab of Weathered Cut Copper")) mcl_stairs.register_slab("waxed_copper_weathered_cut", "mcl_copper:waxed_block_weathered_cut", - {pickaxey = 2}, + {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, @@ -279,7 +279,7 @@ mcl_stairs.register_slab("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", S("Double Slab of Oxidized Cut Copper")) mcl_stairs.register_slab("waxed_copper_oxidized_cut", "mcl_copper:waxed_block_oxidized_cut", - {pickaxey = 2}, + {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, @@ -293,7 +293,7 @@ mcl_stairs.register_stair("copper_cut", "mcl_copper:block_cut", "woodlike") mcl_stairs.register_stair("waxed_copper_cut", "mcl_copper:waxed_block_cut", - {pickaxey = 2}, + {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, @@ -307,7 +307,7 @@ mcl_stairs.register_stair("copper_exposed_cut", "mcl_copper:block_exposed_cut", "woodlike") mcl_stairs.register_stair("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", - {pickaxey = 2}, + {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, @@ -321,7 +321,7 @@ mcl_stairs.register_stair("copper_weathered_cut", "mcl_copper:block_weathered_cu "woodlike") mcl_stairs.register_stair("waxed_copper_weathered_cut", "mcl_copper:waxed_block_weathered_cut", - {pickaxey = 2}, + {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, @@ -335,7 +335,7 @@ mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut" "woodlike") mcl_stairs.register_stair("waxed_copper_oxidized_cut", "mcl_copper:waxed_block_oxidized_cut", - {pickaxey = 2}, + {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, diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index 54a431924..ad507439e 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -22,7 +22,7 @@ function mcl_honey.wax_block(pos, node, player, itemstack) return end - node.name = def._mcl_copper_waxed_variant + node.name = def._mcl_waxed_variant 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 diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index de0ea6261..5f96fa3fa 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -387,6 +387,9 @@ local function make_stripped_trunk(itemstack, placer, pointed_thing) return itemstack else 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") + end if not minetest.is_creative_enabled(placer:get_player_name()) then -- Add wear (as if digging a axey node) local toolname = itemstack:get_name() From 46f6731cf51c36ff4e1befe97020c6dc883de117 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Sat, 20 May 2023 10:44:54 -0600 Subject: [PATCH 6/7] Make oxidized slabs and stairs waxable, and fix the copper oxidation dupe --- mods/ITEMS/mcl_copper/functions.lua | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index 0de387df4..bd289f60f 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -18,7 +18,7 @@ local slab_oxidization = { { "exposed_cut_top", "weathered_cut_top" }, { "exposed_cut_double", "weathered_cut_double" }, { "weathered_cut", "oxidized_cut" }, - { "weathered_cut_top", "oxidized_cut_double" }, + { "weathered_cut_top", "oxidized_cut_top" }, { "weathered_cut_double", "oxidized_cut_double" }, } @@ -106,3 +106,27 @@ for i = 1, #waxed_variants do end +-- Waxed Oxidized Slabs and Stairs +local oxidized_slabs = { + "oxidized_cut", + "oxidized_cut_double", + "oxidized_cut_top" +} + +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 From 75e4000b308cdd488a96dfb0e962dd5a2cc69792 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Thu, 1 Jun 2023 10:18:36 -0600 Subject: [PATCH 7/7] Fix the scraped variants of certain waxed copper blocks Also fix some wording in the oxidation api documentation --- mods/CORE/mcl_oxidation/README.md | 4 ++-- mods/ITEMS/mcl_copper/nodes.lua | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mods/CORE/mcl_oxidation/README.md b/mods/CORE/mcl_oxidation/README.md index 70d9c24fe..3f3291b19 100644 --- a/mods/CORE/mcl_oxidation/README.md +++ b/mods/CORE/mcl_oxidation/README.md @@ -6,9 +6,9 @@ To take advantage of the actual oxidization, put `oxidizable = 1` into the list You would also need to put `_mcl_oxidized_variant = itemstring of node this node will oxidize into` into the node definition. For example, a copper block oxidizes into exposed copper, so the defintion would be `_mcl_oxidized_variant = "mcl_copper:block_exposed"`. -To utilize the ability to wax the block for protection from oxidization, put `mcl_waxed_varient = item string of waxed varient of node` into the node definition table. +To utilize the ability to wax the block for protection from oxidization, put `mcl_waxed_variant = item string of waxed variant of node` into the node definition table. For example, Copper Blocks have the definition arguement of `_mcl_waxed_variant = "mcl_copper:waxed_block"`. For waxed nodes, scraping is easy. Start by putting `waxed = 1` into the list of groups of the waxed node. -Next put `_mcl_stripped_variant = item string of the unwaxed varient of the node` into the defintion table. +Next put `_mcl_stripped_variant = item string of the unwaxed variant of the node` into the defintion table. Wxaed Copper Blocks can be scrapped into normal Copper Blocks because of the definition `_mcl_stripped_variant = "mcl_copper:block"`. diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index b8fa12e4d..af5a49a1c 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -73,7 +73,7 @@ minetest.register_node("mcl_copper:waxed_block_exposed", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block", + _mcl_stripped_variant = "mcl_copper:block_exposed", }) minetest.register_node("mcl_copper:block_weathered", { @@ -99,7 +99,7 @@ minetest.register_node("mcl_copper:waxed_block_weathered", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_exposed", + _mcl_stripped_variant = "mcl_copper:block_weathered", }) minetest.register_node("mcl_copper:block_oxidized", { @@ -124,7 +124,7 @@ minetest.register_node("mcl_copper:waxed_block_oxidized", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_weathered", + _mcl_stripped_variant = "mcl_copper:block_oxidized", }) minetest.register_node("mcl_copper:block_cut", { @@ -175,7 +175,7 @@ minetest.register_node("mcl_copper:waxed_block_exposed_cut", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_cut", + _mcl_stripped_variant = "mcl_copper:block_exposed_cut", }) minetest.register_node("mcl_copper:block_weathered_cut", { @@ -201,7 +201,7 @@ minetest.register_node("mcl_copper:waxed_block_weathered_cut", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_exposed_cut", + _mcl_stripped_variant = "mcl_copper:block_weathered_cut", }) minetest.register_node("mcl_copper:block_oxidized_cut", { @@ -226,7 +226,7 @@ minetest.register_node("mcl_copper:waxed_block_oxidized_cut", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_stripped_variant = "mcl_copper:block_weathered_cut", + _mcl_stripped_variant = "mcl_copper:block_oxidized_cut", }) mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut",