Rebased; Changed the way that the abm handles being called.

Still have to make the scraped variants of the stairs & slabs.
This commit is contained in:
Michieal 2023-02-15 13:41:43 -05:00 committed by Gitea
parent c3cf92baa6
commit 7012175b35
3 changed files with 48 additions and 19 deletions

View File

@ -4,9 +4,9 @@
--- DateTime: 2/15/23 1:11 AM --- DateTime: 2/15/23 1:11 AM
--- ---
function register_oxidation_abm(abm_name, node_name, oxidized_variant) function register_oxidation_abm(node_name)
minetest.register_abm({ minetest.register_abm({
label = abm_name, label = node_name .. "_oxidization_abm",
nodenames = { node_name }, nodenames = { node_name },
interval = 500, interval = 500,
chance = 3, chance = 3,

View File

@ -32,32 +32,55 @@ local block_oxidation = {
} }
local stair_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", "cut", "exposed_cut" },
{ "stair", "exposed_cut", "weathered_cut" },
{ "stair", "weathered_cut", "oxidized_cut" },
{ "stair", "cut_inner", "exposed_cut_inner" }, { "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", "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", "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" } { "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 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 end
local def
local def_variant_oxidized
local def_variant_waxed
-- local def_variant_scraped
for _, s in pairs(stair_oxidation) do 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]) register_oxidation_abm("Copper oxidation", "mcl_stairs:" .. s[1] .. "_copper_" .. s[2])
-- 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. def = "mcl_stairs:" .. s[1] .. "_copper_" .. s[2]
end 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.

View File

@ -34,6 +34,7 @@ minetest.register_node("mcl_copper:block", {
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_oxidized_variant = "mcl_copper:block_exposed",
_mcl_copper_waxed_variant = "mcl_copper:waxed_block", _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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_oxidized_variant = "mcl_copper:block_weathered",
_mcl_copper_waxed_variant = "mcl_copper:waxed_block_exposed", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_exposed",
_mcl_stripped_variant = "mcl_copper:block", _mcl_stripped_variant = "mcl_copper:block",
}) })
@ -83,6 +85,7 @@ minetest.register_node("mcl_copper:block_weathered", {
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_oxidized_variant = "mcl_copper:block_oxidized",
_mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered",
_mcl_stripped_variant = "mcl_copper:block_exposed", _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(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_oxidized_variant = "mcl_copper:block_cut_exposed",
_mcl_copper_waxed_variant = "mcl_copper:waxed_block_cut", _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_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_copper_waxed_variant = "mcl_copper:waxed_block_exposed_cut", _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", _mcl_stripped_variant = "mcl_copper:block_cut",
}) })
@ -183,6 +188,7 @@ minetest.register_node("mcl_copper:block_weathered_cut", {
_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_oxidized_variant = "mcl_copper:block_cut_oxidized",
_mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered_cut", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered_cut",
}) })