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.

This commit is contained in:
Michieal 2023-02-15 14:55:41 -05:00 committed by ancientmarinerdev
parent d6858b7e2a
commit 7c46826958
5 changed files with 99 additions and 54 deletions

View file

@ -1,25 +1,25 @@
local stair_oxidation = { local stair_oxidization = {
{ "stair", "cut", "exposed_cut" }, { "cut", "exposed_cut" },
{ "stair", "cut_inner", "exposed_cut_inner" }, { "cut_inner", "exposed_cut_inner" },
{ "stair", "cut_outer", "exposed_cut_outer" }, { "cut_outer", "exposed_cut_outer" },
{ "stair", "exposed_cut", "weathered_cut" }, { "exposed_cut", "weathered_cut" },
{ "stair", "exposed_cut_inner", "weathered_cut_inner" }, { "exposed_cut_inner", "weathered_cut_inner" },
{ "stair", "exposed_cut_outer", "weathered_cut_outer" }, { "exposed_cut_outer", "weathered_cut_outer" },
{ "stair", "weathered_cut", "oxidized_cut" }, { "weathered_cut", "oxidized_cut" },
{ "stair", "weathered_cut_inner", "oxidized_cut_inner" }, { "weathered_cut_inner", "oxidized_cut_inner" },
{ "stair", "weathered_cut_outer", "oxidized_cut_outer" } { "weathered_cut_outer", "oxidized_cut_outer" }
} }
local slab_oxidization = { local slab_oxidization = {
{ "slab", "cut", "exposed_cut" }, { "cut", "exposed_cut" },
{ "slab", "cut_top", "exposed_cut_top" }, { "cut_top", "exposed_cut_top" },
{ "slab", "cut_double", "exposed_cut_double" }, { "cut_double", "exposed_cut_double" },
{ "slab", "exposed_cut", "weathered_cut" }, { "exposed_cut", "weathered_cut" },
{ "slab", "exposed_cut_top", "weathered_cut_top" }, { "exposed_cut_top", "weathered_cut_top" },
{ "slab", "exposed_cut_double", "weathered_cut_double" }, { "exposed_cut_double", "weathered_cut_double" },
{ "slab", "weathered_cut", "oxidized_cut" }, { "weathered_cut", "oxidized_cut" },
{ "slab", "weathered_cut_top", "oxidized_cut_double" }, { "weathered_cut_top", "oxidized_cut_double" },
{ "slab", "weathered_cut_double", "oxidized_cut_double" }, { "weathered_cut_double", "oxidized_cut_double" },
} }
local def local def
@ -27,39 +27,82 @@ local def_variant_oxidized
local def_variant_waxed local def_variant_waxed
local def_variant_scraped local def_variant_scraped
-- register abm, then set up oxidized and waxed variants. -- set up oxidized and waxed variants.
for _, s in pairs(stair_oxidation) do for i = 1, #stair_oxidization do
def = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] -- stairs
def_variant_oxidized = "mcl_stairs:" .. s[1] .. "_copper_" .. s[3] 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 }) minetest.override_item(def, { _mcl_oxidized_variant = def_variant_oxidized })
def_variant_waxed = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] .. "_waxed" def_variant_waxed = "mcl_stairs:stair_waxed_copper_" .. stair_oxidization[i][2]
minetest.override_item(def, { _mcl_copper_waxed_variant = def_variant_waxed }) minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed })
def = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2]
def_variant_oxidized = "mcl_stairs:" .. s[1] .. "_copper_" .. s[3] -- 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(def, { _mcl_oxidized_variant = def_variant_oxidized })
def_variant_waxed = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2] .. "_waxed" def_variant_waxed = "mcl_stairs:slab_waxed_copper_" .. slab_oxidization[i][1]
minetest.override_item(def, { _mcl_copper_waxed_variant = def_variant_waxed }) minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed })
end end
-- Set up scraped variants. -- 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 if i > 3 then
def = "mcl_stairs:" .. stair_oxidation[i][1] .. "_copper_" .. stair_oxidation[i][2] def = "mcl_stairs:stair_copper_" .. stair_oxidization[i][1]
def_variant_scraped="mcl_stairs:" .. stair_oxidation[i-3][1] .. "_copper_" .. stair_oxidation[i-3][2] def_variant_scraped = "mcl_stairs:stair_copper_" .. stair_oxidization[i - 3][1]
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) 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 }) minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
end end
if i>6 then if i > 6 then
def = "mcl_stairs:" .. stair_oxidation[i][1] .. "_copper_" .. stair_oxidation[i][3] def = "mcl_stairs:stair_copper_" .. stair_oxidization[i][2]
def_variant_scraped="mcl_stairs:" .. stair_oxidation[i][1] .. "_copper_" .. stair_oxidation[i][2] def_variant_scraped = "mcl_stairs:stair_copper_" .. stair_oxidization[i][1]
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped }) 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 }) minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
end 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

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

@ -35,7 +35,7 @@ minetest.register_node("mcl_copper:block", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_oxidized_variant = "mcl_copper:block_exposed", _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", { minetest.register_node("mcl_copper:waxed_block", {
@ -60,7 +60,7 @@ minetest.register_node("mcl_copper:block_exposed", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_oxidized_variant = "mcl_copper:block_weathered", _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", _mcl_stripped_variant = "mcl_copper:block",
}) })
@ -86,7 +86,7 @@ minetest.register_node("mcl_copper:block_weathered", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_oxidized_variant = "mcl_copper:block_oxidized", _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", _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."), _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, oxidizable = 1}, groups = {pickaxey = 2, building_block = 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_oxidized", _mcl_waxed_variant = "mcl_copper:waxed_block_oxidized",
_mcl_stripped_variant = "mcl_copper:block_weathered", _mcl_stripped_variant = "mcl_copper:block_weathered",
}) })
@ -137,7 +137,7 @@ minetest.register_node("mcl_copper:block_cut", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_oxidized_variant = "mcl_copper:block_cut_exposed", _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", { 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(), 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_cut_weathered", _mcl_oxidized_variant = "mcl_copper:block_cut_weathered",
_mcl_stripped_variant = "mcl_copper:block_cut", _mcl_stripped_variant = "mcl_copper:block_cut",
}) })
@ -189,7 +189,7 @@ minetest.register_node("mcl_copper:block_weathered_cut", {
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_stripped_variant = "mcl_copper:block_exposed_cut", _mcl_stripped_variant = "mcl_copper:block_exposed_cut",
_mcl_oxidized_variant = "mcl_copper:block_cut_oxidized", _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", { 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."), _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, oxidizable = 1}, groups = {pickaxey = 2, building_block = 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_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", {
@ -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")) S("Waxed Double Slab of Weathered Cut Copper"))
mcl_stairs.register_slab("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", 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"}, {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"},
S("Slab of Oxidized Cut Copper"), S("Slab of Oxidized Cut Copper"),
nil, nil, nil, nil, nil, nil,
@ -328,7 +328,7 @@ mcl_stairs.register_stair("waxed_copper_weathered_cut", "mcl_copper:waxed_block_
"woodlike") "woodlike")
mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", 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"}, {"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"), S("Stairs of Oxidized Cut Copper"),
nil, 6, nil, nil, 6, nil,

View file

@ -16,7 +16,9 @@ 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