mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 05:43:43 +01:00
Add Oxidization API
This commit is contained in:
parent
3eb2f745e2
commit
4b9fc7046b
14
mods/CORE/mcl_oxidation/README.md
Normal file
14
mods/CORE/mcl_oxidation/README.md
Normal 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_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"`.
|
12
mods/CORE/mcl_oxidation/init.lua
Normal file
12
mods/CORE/mcl_oxidation/init.lua
Normal 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]
|
||||
if def and def._mcl_oxidized_variant then
|
||||
minetest.swap_node(pos, { name = def._mcl_oxidized_varient, param2 = node.param2 })
|
||||
end
|
||||
end,
|
||||
})
|
4
mods/CORE/mcl_oxidation/mod.conf
Normal file
4
mods/CORE/mcl_oxidation/mod.conf
Normal 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.
|
@ -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"},
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user