forked from VoxeLibre/VoxeLibre
Copper oxidation
This commit is contained in:
parent
5d6d60cf26
commit
792c40d7ec
|
@ -2,8 +2,8 @@ mcl_oxidize = {}
|
||||||
|
|
||||||
function mcl_oxidize.oxidize(pos, node, node_def)
|
function mcl_oxidize.oxidize(pos, node, node_def)
|
||||||
local node = node or minetest.get_node(pos)
|
local node = node or minetest.get_node(pos)
|
||||||
local node_def = node_def or registered_nodes[node.name]
|
local node_def = node_def or minetest.registered_nodes[node.name]
|
||||||
node.name = node_def._mcl_oxidized_variant
|
node.name = "blocks:"..node_def._mcl_oxidized_variant
|
||||||
if not node.name then return end
|
if not node.name then return end
|
||||||
|
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
|
@ -12,7 +12,7 @@ local oxidize = mcl_oxidize
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Oxidatize Nodes",
|
label = "Oxidatize Nodes",
|
||||||
nodenames = { "group:oxidizable" },
|
nodenames = {"group:oxidizable"},
|
||||||
interval = 500,
|
interval = 500,
|
||||||
chance = 3,
|
chance = 3,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
|
|
|
@ -23,6 +23,21 @@ end
|
||||||
_G.table.copy = table.copy
|
_G.table.copy = table.copy
|
||||||
_G.table.merge = table.merge
|
_G.table.merge = table.merge
|
||||||
|
|
||||||
|
function string.insert(string, position, substring)
|
||||||
|
if position < 1 or position > #string + 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local part1 = string.sub(string, 1, position - 1)
|
||||||
|
local part2 = string.sub(string, position, #string)
|
||||||
|
|
||||||
|
local new_string = part1..substring..part2
|
||||||
|
|
||||||
|
return new_string
|
||||||
|
end
|
||||||
|
|
||||||
|
_G.string.insert = string.insert
|
||||||
|
|
||||||
function voxelibre.load_mod_files()
|
function voxelibre.load_mod_files()
|
||||||
local mod_path = minetest.get_modpath(minetest.get_current_modname())
|
local mod_path = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,28 @@ local items = {
|
||||||
["glowstone_dust"] = {},
|
["glowstone_dust"] = {},
|
||||||
["gunpowder"] = {},
|
["gunpowder"] = {},
|
||||||
["heart_of_the_sea"] = {},
|
["heart_of_the_sea"] = {},
|
||||||
["honeycomb"] = {},
|
["honeycomb"] = {
|
||||||
|
groups = {ingredients = 1},
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if not placer or pointed_thing.type ~= "node" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local under = pointed_thing.under
|
||||||
|
local unode = minetest.get_node(under)
|
||||||
|
local uname = unode.name
|
||||||
|
|
||||||
|
if minetest.get_item_group(uname, "oxidizable") > 0 then
|
||||||
|
local new_name = string.insert(uname, 8, "waxed_")
|
||||||
|
minetest.swap_node(under, {name = new_name, param2 = unode.param2})
|
||||||
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
},
|
||||||
["ink_sac"] = {},
|
["ink_sac"] = {},
|
||||||
["lapis_lazuli"] = {},
|
["lapis_lazuli"] = {},
|
||||||
["leather"] = {},
|
["leather"] = {},
|
||||||
|
|
|
@ -416,7 +416,7 @@ local function make_stripped_trunk(itemstack, placer, pointed_thing)
|
||||||
local hook = noddef._mcl_on_strip
|
local hook = noddef._mcl_on_strip
|
||||||
if hook then hook(pointed_thing.under, node, noddef) end
|
if hook then hook(pointed_thing.under, node, noddef) end
|
||||||
|
|
||||||
minetest.swap_node(pointed_thing.under, {name=noddef._mcl_stripped_variant, param2=node.param2})
|
minetest.swap_node(pointed_thing.under, {name="blocks:"..noddef._mcl_stripped_variant, param2=node.param2})
|
||||||
if minetest.get_item_group(node_name, "waxed") ~= 0 then
|
if minetest.get_item_group(node_name, "waxed") ~= 0 then
|
||||||
awards.unlock(placer:get_player_name(), "mcl:wax_off")
|
awards.unlock(placer:get_player_name(), "mcl:wax_off")
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,54 +15,169 @@ local common_defs = {
|
||||||
|
|
||||||
local copper_blocks = {
|
local copper_blocks = {
|
||||||
["chiseled_copper"] = {
|
["chiseled_copper"] = {
|
||||||
_mcl_oxidized_variant = "blocks:exposed_chiseled_copper",
|
_mcl_oxidized_variant = "exposed_chiseled_copper",
|
||||||
_mcl_waxed_variant = "blocks:waxed_chiseled_copper",
|
|
||||||
groups = {oxidizable = 1}
|
groups = {oxidizable = 1}
|
||||||
},
|
},
|
||||||
["copper_block"] = {
|
["copper_block"] = {
|
||||||
_mcl_oxidized_variant = "blocks:exposed_copper",
|
_mcl_oxidized_variant = "exposed_copper",
|
||||||
_mcl_waxed_variant = "blocks:waxed_copper_block",
|
|
||||||
description = "Block of Copper",
|
description = "Block of Copper",
|
||||||
groups = {oxidizable = 1, stonecuttable = 1}
|
groups = {oxidizable = 1, stonecuttable = 1}
|
||||||
},
|
},
|
||||||
["copper_grate"] = {
|
["copper_grate"] = {
|
||||||
_mcl_oxidized_variant = "blocks:exposed_copper_grate",
|
_mcl_oxidized_variant = "exposed_copper_grate",
|
||||||
_mcl_waxed_variant = "blocks:waxed_copper_grate",
|
|
||||||
drawtype = "allfaces",
|
drawtype = "allfaces",
|
||||||
groups = {oxidizable = 1},
|
groups = {oxidizable = 1},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true
|
sunlight_propagates = true
|
||||||
},
|
},
|
||||||
["cut_copper"] = {
|
["cut_copper"] = {
|
||||||
_mcl_oxidized_variant = "blocks:exposed_cut_copper",
|
_mcl_oxidized_variant = "exposed_cut_copper",
|
||||||
_mcl_waxed_variant = "blocks:waxed_cut_copper",
|
|
||||||
groups = {oxidizable = 1, stonecuttable = 1}
|
groups = {oxidizable = 1, stonecuttable = 1}
|
||||||
},
|
},
|
||||||
["exposed_chiseled_copper"] = {
|
["exposed_chiseled_copper"] = {
|
||||||
_mcl_oxidized_variant = "blocks:weathered_chiseled_copper",
|
_mcl_oxidized_variant = "weathered_chiseled_copper",
|
||||||
_mcl_stripped_variant = "blocks:chiseled_copper",
|
_mcl_stripped_variant = "chiseled_copper",
|
||||||
_mcl_waxed_variant = "blocks:waxed_exposed_chiseled_copper",
|
|
||||||
groups = {oxidizable = 1}
|
groups = {oxidizable = 1}
|
||||||
},
|
},
|
||||||
["exposed_copper"] = {
|
["exposed_copper"] = {
|
||||||
_mcl_oxidized_variant = "blocks:weathered_copper",
|
_mcl_oxidized_variant = "weathered_copper",
|
||||||
_mcl_stripped_variant = "blocks:copper_block",
|
_mcl_stripped_variant = "copper_block",
|
||||||
_mcl_waxed_variant = "blocks:waxed_exposed_copper",
|
|
||||||
groups = {oxidizable = 1, stonecuttable = 1}
|
groups = {oxidizable = 1, stonecuttable = 1}
|
||||||
},
|
},
|
||||||
["exposed_copper_grate"] = {
|
["exposed_copper_grate"] = {
|
||||||
_mcl_oxidized_variant = "blocks:weathered_copper_grate",
|
_mcl_oxidized_variant = "weathered_copper_grate",
|
||||||
_mcl_waxed_variant = "blocks:waxed_exposed_copper_grate",
|
_mcl_stripped_variant = "copper_grate",
|
||||||
drawtype = "allfaces",
|
drawtype = "allfaces",
|
||||||
groups = {oxidizable = 1},
|
groups = {oxidizable = 1},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true
|
sunlight_propagates = true
|
||||||
},
|
},
|
||||||
["exposed_cut_copper"] = {
|
["exposed_cut_copper"] = {
|
||||||
_mcl_oxidized_variant = "blocks:weathered_cut_copper",
|
_mcl_oxidized_variant = "weathered_cut_copper",
|
||||||
_mcl_stripped_variant = "blocks:cut_copper",
|
_mcl_stripped_variant = "cut_copper",
|
||||||
_mcl_waxed_variant = "blocks:waxed_exposed_cut_copper",
|
|
||||||
groups = {oxidizable = 1, stonecuttable = 1}
|
groups = {oxidizable = 1, stonecuttable = 1}
|
||||||
|
},
|
||||||
|
["oxidized_chiseled_copper"] = {
|
||||||
|
_mcl_stripped_variant = "weathered_chiseled_copper"
|
||||||
|
},
|
||||||
|
["oxidized_copper"] = {
|
||||||
|
_mcl_stripped_variant = "weathered_copper",
|
||||||
|
groups = {stonecuttable = 1}
|
||||||
|
},
|
||||||
|
["oxidized_copper_grate"] = {
|
||||||
|
_mcl_stripped_variant = "weathered_copper_grate",
|
||||||
|
drawtype = "allfaces",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true
|
||||||
|
},
|
||||||
|
["oxidized_cut_copper"] = {
|
||||||
|
_mcl_stripped_variant = "weathered_cut_copper",
|
||||||
|
groups = {stonecuttable = 1}
|
||||||
|
},
|
||||||
|
["waxed_chiseled_copper"] = {
|
||||||
|
_mcl_stripped_variant = "chiseled_copper",
|
||||||
|
tiles = {"building_chiseled_copper.png"}
|
||||||
|
},
|
||||||
|
["waxed_copper_block"] = {
|
||||||
|
_mcl_stripped_variant = "copper_block",
|
||||||
|
description = "Waxed Block of Copper",
|
||||||
|
groups = {stonecuttable = 1},
|
||||||
|
tiles = {"building_copper_block.png"}
|
||||||
|
},
|
||||||
|
["waxed_copper_grate"] = {
|
||||||
|
_mcl_stripped_variant = "copper_grate",
|
||||||
|
drawtype = "allfaces",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {"building_copper_grate.png"}
|
||||||
|
},
|
||||||
|
["waxed_cut_copper"] = {
|
||||||
|
_mcl_stripped_variant = "cut_copper",
|
||||||
|
groups = {stonecuttable = 1},
|
||||||
|
tiles = {"building_cut_copper.png"}
|
||||||
|
},
|
||||||
|
["waxed_exposed_chiseled_copper"] = {
|
||||||
|
_mcl_stripped_variant = "exposed_chiseled_copper",
|
||||||
|
tiles = {"building_exposed_chiseled_copper.png"}
|
||||||
|
},
|
||||||
|
["waxed_exposed_copper"] = {
|
||||||
|
_mcl_stripped_variant = "exposed_copper",
|
||||||
|
groups = {stonecuttable = 1},
|
||||||
|
tiles = {"building_exposed_copper.png"}
|
||||||
|
},
|
||||||
|
["waxed_exposed_copper_grate"] = {
|
||||||
|
_mcl_stripped_variant = "exposed_copper_grate",
|
||||||
|
drawtype = "allfaces",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {"building_exposed_copper_grate.png"}
|
||||||
|
},
|
||||||
|
["waxed_exposed_cut_copper"] = {
|
||||||
|
_mcl_stripped_variant = "exposed_cut_copper",
|
||||||
|
groups = {stonecuttable = 1},
|
||||||
|
tiles = {"building_exposed_cut_copper.png"}
|
||||||
|
},
|
||||||
|
["waxed_oxidized_chiseled_copper"] = {
|
||||||
|
_mcl_stripped_variant = "oxidized_chiseled_copper",
|
||||||
|
tiles = {"building_oxidized_chiseled_copper.png"}
|
||||||
|
},
|
||||||
|
["waxed_oxidized_copper"] = {
|
||||||
|
_mcl_stripped_variant = "oxidized_copper",
|
||||||
|
tiles = {"building_oxidized_copper.png"}
|
||||||
|
},
|
||||||
|
["waxed_oxidized_copper_grate"] = {
|
||||||
|
_mcl_stripped_variant = "oxidized_copper_grate",
|
||||||
|
drawtype = "allfaces",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {"building_oxidized_copper_grate.png"}
|
||||||
|
},
|
||||||
|
["waxed_oxidized_cut_copper"] = {
|
||||||
|
_mcl_stripped_variant = "oxidized_cut_copper",
|
||||||
|
groups = {stonecuttable = 1},
|
||||||
|
tiles = {"building_oxidized_cut_copper.png"}
|
||||||
|
},
|
||||||
|
["waxed_weathered_chiseled_copper"] = {
|
||||||
|
_mcl_stripped_variant = "weathered_chiseled_copper",
|
||||||
|
tiles = {"building_weathered_chiseled_copper.png"}
|
||||||
|
},
|
||||||
|
["waxed_weathered_copper"] = {
|
||||||
|
_mcl_stripped_variant = "weathered_copper",
|
||||||
|
groups = {stonecuttable = 1},
|
||||||
|
tiles = {"building_weathered_copper.png"}
|
||||||
|
},
|
||||||
|
["waxed_weathered_copper_grate"] = {
|
||||||
|
_mcl_stripped_variant = "weathered_copper_grate",
|
||||||
|
drawtype = "allfaces",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {"building_weathered_copper_grate.png"}
|
||||||
|
},
|
||||||
|
["waxed_weathered_cut_copper"] = {
|
||||||
|
_mcl_stripped_variant = "weathered_cut_copper",
|
||||||
|
groups = {stonecuttable = 1},
|
||||||
|
tiles = {"building_weathered_cut_copper.png"}
|
||||||
|
},
|
||||||
|
["weathered_chiseled_copper"] = {
|
||||||
|
_mcl_oxidized_variant = "oxidized_chiseled_copper",
|
||||||
|
_mcl_stripped_variant = "exposed_chiseled_copper"
|
||||||
|
},
|
||||||
|
["weathered_copper"] = {
|
||||||
|
_mcl_oxidized_variant = "oxidized_copper",
|
||||||
|
_mcl_stripped_variant = "exposed_copper",
|
||||||
|
groups = {stonecuttable = 1}
|
||||||
|
},
|
||||||
|
["weathered_copper_grate"] = {
|
||||||
|
_mcl_oxidized_variant = "oxidized_copper_grate",
|
||||||
|
_mcl_stripped_variant = "exposed_copper_grate",
|
||||||
|
drawtype = "allfaces",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true
|
||||||
|
},
|
||||||
|
["weathered_cut_copper"] = {
|
||||||
|
_mcl_oxidized_variant = "oxidized_cut_copper",
|
||||||
|
_mcl_stripped_variant = "weathered_cut_copper",
|
||||||
|
groups = {stonecuttable = 1}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue