Merge pull request 'Oxidation API' (#3748) from oxidation_api into master

Reviewed-on: MineClone2/MineClone2#3748
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
This commit is contained in:
ancientmarinerdev 2023-06-02 20:34:26 +00:00
commit 46d486c7cb
9 changed files with 211 additions and 113 deletions

View File

@ -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_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 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"`.

View File

@ -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.name]
if def and def._mcl_oxidized_variant then
minetest.set_node(pos, { name = def._mcl_oxidized_variant, param2 = node.param2 })
end
end,
})

View File

@ -0,0 +1,4 @@
name = mcl_oxidation
title = Oxidation API for MineClone 2
author = PrairieWind, N011, Michael
description = API to allow oxidizing different nodes.

View File

@ -1,75 +1,132 @@
--local deepslate_mod = minetest.get_modpath("mcl_deepslate") local stair_oxidization = {
{ "cut", "exposed_cut" },
local function register_oxidation_abm(abm_name, node_name, oxidized_variant) { "cut_inner", "exposed_cut_inner" },
minetest.register_abm({ { "cut_outer", "exposed_cut_outer" },
label = abm_name, { "exposed_cut", "weathered_cut" },
nodenames = { node_name }, { "exposed_cut_inner", "weathered_cut_inner" },
interval = 500, { "exposed_cut_outer", "weathered_cut_outer" },
chance = 3, { "weathered_cut", "oxidized_cut" },
action = function(pos, node) { "weathered_cut_inner", "oxidized_cut_inner" },
minetest.swap_node(pos, { name = oxidized_variant, param2 = node.param2 }) { "weathered_cut_outer", "oxidized_cut_outer" }
end,
})
end
--[[
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 = { local slab_oxidization = {
{ "slab", "cut", "exposed_cut" }, { "cut", "exposed_cut" },
{ "slab", "exposed_cut", "weathered_cut" }, { "cut_top", "exposed_cut_top" },
{ "slab", "weathered_cut", "oxidized_cut" }, { "cut_double", "exposed_cut_double" },
{ "slab", "cut_top", "exposed_cut_top" }, { "exposed_cut", "weathered_cut" },
{ "slab", "exposed_cut_top", "weathered_cut_top" }, { "exposed_cut_top", "weathered_cut_top" },
{ "slab", "weathered_cut_top", "oxidized_cut_double" }, { "exposed_cut_double", "weathered_cut_double" },
{ "slab", "cut_double", "exposed_cut_double" }, { "weathered_cut", "oxidized_cut" },
{ "slab", "exposed_cut_double", "weathered_cut_double" }, { "weathered_cut_top", "oxidized_cut_top" },
{ "slab", "weathered_cut_double", "oxidized_cut_double" }, { "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_outer", "weathered_cut_outer" },
{ "stair", "weathered_cut_outer", "oxidized_cut_outer" }
} }
for _, b in pairs(block_oxidation) do local def
register_oxidation_abm("Copper oxidation", "mcl_copper:block" .. b[1], "mcl_copper:block" .. b[2]) local def_variant_oxidized
local def_variant_waxed
local def_variant_scraped
-- 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:stair_waxed_copper_" .. stair_oxidization[i][1]
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:slab_waxed_copper_" .. slab_oxidization[i][1]
minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed })
end end
for _, s in pairs(stair_oxidation) do -- Set up scraped variants.
register_oxidation_abm("Copper oxidation", "mcl_stairs:" .. s[1] .. "_copper_" .. s[2], "mcl_stairs:" .. s[1] .. "_copper_" .. s[3]) for i = 1, #stair_oxidization do
-- 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. -- 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 })
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" },
}
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
-- 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

View File

@ -2,7 +2,7 @@ local path = minetest.get_modpath("mcl_copper")
mcl_copper = {} -- initialize global variable. mcl_copper = {} -- initialize global variable.
dofile(path .. "/functions.lua")
dofile(path .. "/nodes.lua") dofile(path .. "/nodes.lua")
dofile(path .. "/items.lua") dofile(path .. "/items.lua")
dofile(path .. "/crafting.lua") dofile(path .. "/crafting.lua")
dofile(path .. "/functions.lua")

View File

@ -1,4 +1,4 @@
name = mcl_copper name = mcl_copper
author = NO11 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. description = Adds Copper Ore, blocks and items.

View File

@ -30,11 +30,12 @@ minetest.register_node("mcl_copper:block", {
_doc_items_longdesc = S("A block of copper is mostly a decorative block."), _doc_items_longdesc = S("A block of copper is mostly a decorative block."),
tiles = {"mcl_copper_block.png"}, tiles = {"mcl_copper_block.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_copper_waxed_variant = "mcl_copper:waxed_block", _mcl_oxidized_variant = "mcl_copper:block_exposed",
_mcl_waxed_variant = "mcl_copper:waxed_block",
}) })
minetest.register_node("mcl_copper:waxed_block", { minetest.register_node("mcl_copper:waxed_block", {
@ -42,7 +43,7 @@ minetest.register_node("mcl_copper:waxed_block", {
_doc_items_longdesc = S("A block of copper is mostly a decorative block."), _doc_items_longdesc = S("A block of copper is mostly a decorative block."),
tiles = {"mcl_copper_block.png"}, tiles = {"mcl_copper_block.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 3, _mcl_hardness = 3,
@ -54,11 +55,12 @@ minetest.register_node("mcl_copper:block_exposed", {
_doc_items_longdesc = S("Exposed copper is a decorative block."), _doc_items_longdesc = S("Exposed copper is a decorative block."),
tiles = {"mcl_copper_exposed.png"}, tiles = {"mcl_copper_exposed.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_copper_waxed_variant = "mcl_copper:waxed_block_exposed", _mcl_oxidized_variant = "mcl_copper:block_weathered",
_mcl_waxed_variant = "mcl_copper:waxed_block_exposed",
_mcl_stripped_variant = "mcl_copper:block", _mcl_stripped_variant = "mcl_copper:block",
}) })
@ -67,11 +69,11 @@ minetest.register_node("mcl_copper:waxed_block_exposed", {
_doc_items_longdesc = S("Exposed copper is a decorative block."), _doc_items_longdesc = S("Exposed copper is a decorative block."),
tiles = {"mcl_copper_exposed.png"}, tiles = {"mcl_copper_exposed.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_stripped_variant = "mcl_copper:block", _mcl_stripped_variant = "mcl_copper:block_exposed",
}) })
minetest.register_node("mcl_copper:block_weathered", { minetest.register_node("mcl_copper:block_weathered", {
@ -79,11 +81,12 @@ minetest.register_node("mcl_copper:block_weathered", {
_doc_items_longdesc = S("Weathered copper is a decorative block."), _doc_items_longdesc = S("Weathered copper is a decorative block."),
tiles = {"mcl_copper_weathered.png"}, tiles = {"mcl_copper_weathered.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered", _mcl_oxidized_variant = "mcl_copper:block_oxidized",
_mcl_waxed_variant = "mcl_copper:waxed_block_weathered",
_mcl_stripped_variant = "mcl_copper:block_exposed", _mcl_stripped_variant = "mcl_copper:block_exposed",
}) })
@ -92,11 +95,11 @@ minetest.register_node("mcl_copper:waxed_block_weathered", {
_doc_items_longdesc = S("Weathered copper is a decorative block."), _doc_items_longdesc = S("Weathered copper is a decorative block."),
tiles = {"mcl_copper_weathered.png"}, tiles = {"mcl_copper_weathered.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_stripped_variant = "mcl_copper:block_exposed", _mcl_stripped_variant = "mcl_copper:block_weathered",
}) })
minetest.register_node("mcl_copper:block_oxidized", { minetest.register_node("mcl_copper:block_oxidized", {
@ -108,7 +111,7 @@ minetest.register_node("mcl_copper:block_oxidized", {
sounds = mcl_sounds.node_sound_metal_defaults(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _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", _mcl_stripped_variant = "mcl_copper:block_weathered",
}) })
@ -117,11 +120,11 @@ minetest.register_node("mcl_copper:waxed_block_oxidized", {
_doc_items_longdesc = S("Oxidized copper is a decorative block."), _doc_items_longdesc = S("Oxidized copper is a decorative block."),
tiles = {"mcl_copper_oxidized.png"}, tiles = {"mcl_copper_oxidized.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_stripped_variant = "mcl_copper:block_weathered", _mcl_stripped_variant = "mcl_copper:block_oxidized",
}) })
minetest.register_node("mcl_copper:block_cut", { minetest.register_node("mcl_copper:block_cut", {
@ -129,11 +132,12 @@ minetest.register_node("mcl_copper:block_cut", {
_doc_items_longdesc = S("Cut copper is a decorative block."), _doc_items_longdesc = S("Cut copper is a decorative block."),
tiles = {"mcl_copper_block_cut.png"}, tiles = {"mcl_copper_block_cut.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_copper_waxed_variant = "mcl_copper:waxed_block_cut", _mcl_oxidized_variant = "mcl_copper:block_exposed_cut",
_mcl_waxed_variant = "mcl_copper:waxed_block_cut",
}) })
minetest.register_node("mcl_copper:waxed_block_cut", { minetest.register_node("mcl_copper:waxed_block_cut", {
@ -141,7 +145,7 @@ minetest.register_node("mcl_copper:waxed_block_cut", {
_doc_items_longdesc = S("Cut copper is a decorative block."), _doc_items_longdesc = S("Cut copper is a decorative block."),
tiles = {"mcl_copper_block_cut.png"}, tiles = {"mcl_copper_block_cut.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
@ -153,11 +157,12 @@ minetest.register_node("mcl_copper:block_exposed_cut", {
_doc_items_longdesc = S("Exposed cut copper is a decorative block."), _doc_items_longdesc = S("Exposed cut copper is a decorative block."),
tiles = {"mcl_copper_exposed_cut.png"}, tiles = {"mcl_copper_exposed_cut.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _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_weathered_cut",
_mcl_stripped_variant = "mcl_copper:block_cut", _mcl_stripped_variant = "mcl_copper:block_cut",
}) })
@ -166,11 +171,11 @@ minetest.register_node("mcl_copper:waxed_block_exposed_cut", {
_doc_items_longdesc = S("Exposed cut copper is a decorative block."), _doc_items_longdesc = S("Exposed cut copper is a decorative block."),
tiles = {"mcl_copper_exposed_cut.png"}, tiles = {"mcl_copper_exposed_cut.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _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", { minetest.register_node("mcl_copper:block_weathered_cut", {
@ -178,12 +183,13 @@ minetest.register_node("mcl_copper:block_weathered_cut", {
_doc_items_longdesc = S("Weathered cut copper is a decorative block."), _doc_items_longdesc = S("Weathered cut copper is a decorative block."),
tiles = {"mcl_copper_weathered_cut.png"}, tiles = {"mcl_copper_weathered_cut.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_stripped_variant = "mcl_copper:block_exposed_cut", _mcl_stripped_variant = "mcl_copper:block_exposed_cut",
_mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered_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", { minetest.register_node("mcl_copper:waxed_block_weathered_cut", {
@ -191,11 +197,11 @@ minetest.register_node("mcl_copper:waxed_block_weathered_cut", {
_doc_items_longdesc = S("Weathered cut copper is a decorative block."), _doc_items_longdesc = S("Weathered cut copper is a decorative block."),
tiles = {"mcl_copper_weathered_cut.png"}, tiles = {"mcl_copper_weathered_cut.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _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", { minetest.register_node("mcl_copper:block_oxidized_cut", {
@ -208,7 +214,7 @@ minetest.register_node("mcl_copper:block_oxidized_cut", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_stripped_variant = "mcl_copper:block_weathered_cut", _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", { minetest.register_node("mcl_copper:waxed_block_oxidized_cut", {
@ -216,50 +222,50 @@ minetest.register_node("mcl_copper:waxed_block_oxidized_cut", {
_doc_items_longdesc = S("Oxidized cut copper is a decorative block."), _doc_items_longdesc = S("Oxidized cut copper is a decorative block."),
tiles = {"mcl_copper_oxidized_cut.png"}, tiles = {"mcl_copper_oxidized_cut.png"},
is_ground_content = false, 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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _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", 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"}, {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"},
S("Slab of Cut Copper"), S("Slab of Cut Copper"),
nil, nil, nil, nil, nil, nil,
S("Double Slab of Cut Copper")) S("Double Slab of Cut Copper"))
mcl_stairs.register_slab("waxed_copper_cut", "mcl_copper:waxed_block_cut", 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"}, {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"},
S("Waxed Slab of Cut Copper"), S("Waxed Slab of Cut Copper"),
nil, nil, nil, nil, nil, nil,
S("Waxed Double Slab of Cut Copper")) S("Waxed Double Slab of Cut Copper"))
mcl_stairs.register_slab("copper_exposed_cut", "mcl_copper:block_exposed_cut", 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"}, {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"},
S("Slab of Exposed Cut Copper"), S("Slab of Exposed Cut Copper"),
nil, nil, nil, nil, nil, nil,
S("Double Slab of Exposed Cut Copper")) S("Double Slab of Exposed Cut Copper"))
mcl_stairs.register_slab("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", 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"}, {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"},
S("Waxed Slab of Exposed Cut Copper"), S("Waxed Slab of Exposed Cut Copper"),
nil, nil, nil, nil, nil, nil,
S("Waxed Double Slab of Exposed Cut Copper")) S("Waxed Double Slab of Exposed Cut Copper"))
mcl_stairs.register_slab("copper_weathered_cut", "mcl_copper:block_weathered_cut", 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"}, {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"},
S("Slab of Weathered Cut Copper"), S("Slab of Weathered Cut Copper"),
nil, nil, nil, nil, nil, nil,
S("Double Slab of Weathered Cut Copper")) S("Double Slab of Weathered Cut Copper"))
mcl_stairs.register_slab("waxed_copper_weathered_cut", "mcl_copper:waxed_block_weathered_cut", 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"}, {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"},
S("Waxed Slab of Weathered Cut Copper"), S("Waxed Slab of Weathered Cut Copper"),
nil, nil, nil, nil, nil, nil,
@ -273,49 +279,49 @@ mcl_stairs.register_slab("copper_oxidized_cut", "mcl_copper:block_oxidized_cut",
S("Double Slab of Oxidized Cut Copper")) S("Double Slab of Oxidized Cut Copper"))
mcl_stairs.register_slab("waxed_copper_oxidized_cut", "mcl_copper:waxed_block_oxidized_cut", 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"}, {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"},
S("Waxed Slab of Oxidized Cut Copper"), S("Waxed Slab of Oxidized Cut Copper"),
nil, nil, nil, nil, nil, nil,
S("Waxed Double Slab of Oxidized Cut Copper")) S("Waxed Double Slab of Oxidized Cut Copper"))
mcl_stairs.register_stair("copper_cut", "mcl_copper:block_cut", 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"}, {"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"), S("Stairs of Cut Copper"),
nil, 6, nil, nil, 6, nil,
"woodlike") "woodlike")
mcl_stairs.register_stair("waxed_copper_cut", "mcl_copper:waxed_block_cut", 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"}, {"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"), S("Waxed Stairs of Cut Copper"),
nil, 6, nil, nil, 6, nil,
"woodlike") "woodlike")
mcl_stairs.register_stair("copper_exposed_cut", "mcl_copper:block_exposed_cut", 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"}, {"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"), S("Stairs of Exposed Cut Copper"),
nil, 6, nil, nil, 6, nil,
"woodlike") "woodlike")
mcl_stairs.register_stair("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", 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"}, {"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"), S("Waxed Stairs of Exposed Cut Copper"),
nil, 6, nil, nil, 6, nil,
"woodlike") "woodlike")
mcl_stairs.register_stair("copper_weathered_cut", "mcl_copper:block_weathered_cut", 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"}, {"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"), S("Stairs of Weathered Cut Copper"),
nil, 6, nil, nil, 6, nil,
"woodlike") "woodlike")
mcl_stairs.register_stair("waxed_copper_weathered_cut", "mcl_copper:waxed_block_weathered_cut", 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"}, {"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"), S("Waxed Stairs of Weathered Cut Copper"),
nil, 6, nil, nil, 6, nil,
@ -329,7 +335,7 @@ mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut"
"woodlike") "woodlike")
mcl_stairs.register_stair("waxed_copper_oxidized_cut", "mcl_copper:waxed_block_oxidized_cut", 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"}, {"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"), S("Waxed Stairs of Oxidized Cut Copper"),
nil, 6, nil, nil, 6, nil,

View File

@ -16,11 +16,13 @@ function mcl_honey.wax_block(pos, node, player, itemstack)
local def = minetest.registered_nodes[node.name] 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 return
end end
node.name = def._mcl_copper_waxed_variant node.name = def._mcl_waxed_variant
minetest.set_node(pos, node) minetest.set_node(pos, node)
awards.unlock(player:get_player_name(), "mcl:wax_on") awards.unlock(player:get_player_name(), "mcl:wax_on")
if not minetest.is_creative_enabled(player:get_player_name()) then if not minetest.is_creative_enabled(player:get_player_name()) then

View File

@ -387,6 +387,9 @@ local function make_stripped_trunk(itemstack, placer, pointed_thing)
return itemstack return itemstack
else else
minetest.swap_node(pointed_thing.under, {name=noddef._mcl_stripped_variant, param2=node.param2}) 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 if not minetest.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a axey node) -- Add wear (as if digging a axey node)
local toolname = itemstack:get_name() local toolname = itemstack:get_name()