forked from VoxeLibre/VoxeLibre
Oxidation, scrapping and waxing for copper doors
This commit is contained in:
parent
802137f355
commit
f83d1b18cd
|
@ -6,6 +6,15 @@ minetest.register_abm({
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
if def and def._mcl_oxidized_variant then
|
if def and def._mcl_oxidized_variant then
|
||||||
|
if def.groups.door == 1 then
|
||||||
|
if node.name:find("_b_") then
|
||||||
|
local top_pos = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||||
|
minetest.set_node(top_pos, { name = def._mcl_oxidized_variant:gsub("_b_", "_t_"), param2 = node.param2 })
|
||||||
|
elseif node.name:find("_t_") then
|
||||||
|
local bot_pos = { x = pos.x, y = pos.y - 1, z = pos.z }
|
||||||
|
minetest.set_node(bot_pos, { name = def._mcl_oxidized_variant:gsub("_t_", "_b_"), param2 = node.param2 })
|
||||||
|
end
|
||||||
|
end
|
||||||
minetest.set_node(pos, { name = def._mcl_oxidized_variant, param2 = node.param2 })
|
minetest.set_node(pos, { name = def._mcl_oxidized_variant, param2 = node.param2 })
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -21,6 +21,16 @@ function mcl_copper.register_oxidation_and_scraping(mod_name, subname, decay_cha
|
||||||
elseif subname:find("trapdoor") then
|
elseif subname:find("trapdoor") then
|
||||||
minetest.override_item(item.."_open", {_mcl_oxidized_variant = oxidized_item.."_open"})
|
minetest.override_item(item.."_open", {_mcl_oxidized_variant = oxidized_item.."_open"})
|
||||||
minetest.override_item(oxidized_item.."_open", {_mcl_stripped_variant = item.."_open"})
|
minetest.override_item(oxidized_item.."_open", {_mcl_stripped_variant = item.."_open"})
|
||||||
|
elseif subname == "door" then
|
||||||
|
minetest.override_item(item.."_b_1", {_mcl_oxidized_variant = oxidized_item.."_b_1"})
|
||||||
|
minetest.override_item(oxidized_item.."_b_1", {_mcl_stripped_variant = item.."_b_1"})
|
||||||
|
minetest.override_item(item.."_t_1", {_mcl_oxidized_variant = oxidized_item.."_t_1"})
|
||||||
|
minetest.override_item(oxidized_item.."_t_1", {_mcl_stripped_variant = item.."_t_1"})
|
||||||
|
|
||||||
|
minetest.override_item(item.."_b_2", {_mcl_oxidized_variant = oxidized_item.."_b_2"})
|
||||||
|
minetest.override_item(oxidized_item.."_b_2", {_mcl_stripped_variant = item.."_b_2"})
|
||||||
|
minetest.override_item(item.."_t_2", {_mcl_oxidized_variant = oxidized_item.."_t_2"})
|
||||||
|
minetest.override_item(oxidized_item.."_t_2", {_mcl_stripped_variant = item.."_t_2"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -48,6 +58,16 @@ function mcl_copper.register_waxing_and_scraping(mod_name, subname, decay_chain)
|
||||||
elseif subname:find("trapdoor") then
|
elseif subname:find("trapdoor") then
|
||||||
minetest.override_item(waxed_item.."_open", {_mcl_stripped_variant = unwaxed_item.."_open"})
|
minetest.override_item(waxed_item.."_open", {_mcl_stripped_variant = unwaxed_item.."_open"})
|
||||||
minetest.override_item(unwaxed_item.."_open", {_mcl_waxed_variant = waxed_item.."_open"})
|
minetest.override_item(unwaxed_item.."_open", {_mcl_waxed_variant = waxed_item.."_open"})
|
||||||
|
elseif subname == "waxed_door" then
|
||||||
|
minetest.override_item(waxed_item.."_b_1", {_mcl_stripped_variant = unwaxed_item.."_b_1"})
|
||||||
|
minetest.override_item(unwaxed_item.."_b_1", {_mcl_waxed_variant = waxed_item.."_b_1"})
|
||||||
|
minetest.override_item(waxed_item.."_t_1", {_mcl_stripped_variant = unwaxed_item.."_t_1"})
|
||||||
|
minetest.override_item(unwaxed_item.."_t_1", {_mcl_waxed_variant = waxed_item.."_t_1"})
|
||||||
|
|
||||||
|
minetest.override_item(waxed_item.."_b_2", {_mcl_stripped_variant = unwaxed_item.."_b_2"})
|
||||||
|
minetest.override_item(unwaxed_item.."_b_2", {_mcl_waxed_variant = waxed_item.."_b_2"})
|
||||||
|
minetest.override_item(waxed_item.."_t_2", {_mcl_stripped_variant = unwaxed_item.."_t_2"})
|
||||||
|
minetest.override_item(unwaxed_item.."_t_2", {_mcl_waxed_variant = waxed_item.."_t_2"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -58,13 +78,7 @@ local cut_decay_chain = {
|
||||||
"_weathered_cut",
|
"_weathered_cut",
|
||||||
"_oxidized_cut"
|
"_oxidized_cut"
|
||||||
}
|
}
|
||||||
local trapdoor_decay_chain = {
|
local doors_decay_chain = {
|
||||||
"",
|
|
||||||
"_exposed",
|
|
||||||
"_weathered",
|
|
||||||
"_oxidized"
|
|
||||||
}
|
|
||||||
local waxed_trapdoor_decay_chain = {
|
|
||||||
"",
|
"",
|
||||||
"_exposed",
|
"_exposed",
|
||||||
"_weathered",
|
"_weathered",
|
||||||
|
@ -73,7 +87,9 @@ local waxed_trapdoor_decay_chain = {
|
||||||
|
|
||||||
mcl_copper.register_oxidation_and_scraping("mcl_stairs", "stair_copper", cut_decay_chain)
|
mcl_copper.register_oxidation_and_scraping("mcl_stairs", "stair_copper", cut_decay_chain)
|
||||||
mcl_copper.register_oxidation_and_scraping("mcl_stairs", "slab_copper", cut_decay_chain)
|
mcl_copper.register_oxidation_and_scraping("mcl_stairs", "slab_copper", cut_decay_chain)
|
||||||
mcl_copper.register_oxidation_and_scraping("mcl_copper", "trapdoor", trapdoor_decay_chain)
|
mcl_copper.register_oxidation_and_scraping("mcl_copper", "trapdoor", doors_decay_chain)
|
||||||
|
mcl_copper.register_oxidation_and_scraping("mcl_copper", "door", doors_decay_chain)
|
||||||
mcl_copper.register_waxing_and_scraping("mcl_stairs", "stair_waxed_copper", cut_decay_chain)
|
mcl_copper.register_waxing_and_scraping("mcl_stairs", "stair_waxed_copper", cut_decay_chain)
|
||||||
mcl_copper.register_waxing_and_scraping("mcl_stairs", "slab_waxed_copper", cut_decay_chain)
|
mcl_copper.register_waxing_and_scraping("mcl_stairs", "slab_waxed_copper", cut_decay_chain)
|
||||||
mcl_copper.register_waxing_and_scraping("mcl_copper", "waxed_trapdoor", waxed_trapdoor_decay_chain)
|
mcl_copper.register_waxing_and_scraping("mcl_copper", "waxed_trapdoor", doors_decay_chain)
|
||||||
|
mcl_copper.register_waxing_and_scraping("mcl_copper", "waxed_door", doors_decay_chain)
|
||||||
|
|
|
@ -8,22 +8,35 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
local alldirs = { { x = 0, y = 0, z = 1 }, { x = 1, y = 0, z = 0 }, { x = 0, y = 0, z = -1 }, { x = -1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 }, { x = 0, y = 1, z = 0 } }
|
local alldirs = { { x = 0, y = 0, z = 1 }, { x = 1, y = 0, z = 0 }, { x = 0, y = 0, z = -1 }, { x = -1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 }, { x = 0, y = 1, z = 0 } }
|
||||||
|
|
||||||
-- Waxing Function
|
-- Waxing Function
|
||||||
function mcl_honey.wax_block(pos, node, player, itemstack)
|
function mcl_honey.wax_block(pos, node, player, itemstack, pointed_thing)
|
||||||
-- prevent modification of protected nodes.
|
-- prevent modification of protected nodes.
|
||||||
if mcl_util.check_position_protection(pos, player) then
|
if mcl_util.check_position_protection(pos, player) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
|
if player:get_player_control().sneak then
|
||||||
if def and def._mcl_waxed_variant then
|
if def and def._mcl_waxed_variant then
|
||||||
node.name = def._mcl_waxed_variant
|
if def.groups.door == 1 then
|
||||||
|
if node.name:find("_b_") then
|
||||||
|
local top_pos = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||||
|
minetest.swap_node(top_pos, { name = def._mcl_waxed_variant:gsub("_b_", "_t_") })
|
||||||
|
elseif node.name:find("_t_") then
|
||||||
|
local bot_pos = { x = pos.x, y = pos.y - 1, z = pos.z }
|
||||||
|
minetest.swap_node(bot_pos, { name = def._mcl_waxed_variant:gsub("_t_", "_b_") })
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
if def and def.on_rightclick then
|
||||||
|
return def.on_rightclick(pos, node, player, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
node.name = def._mcl_waxed_variant
|
node.name = def._mcl_waxed_variant
|
||||||
minetest.set_node(pos, node)
|
minetest.swap_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
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
|
@ -46,7 +59,7 @@ minetest.register_craftitem("mcl_honey:honeycomb", {
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
|
|
||||||
-- wax the block. This is the only viable usage of honeycomb's on_place. If it "fails" to wax, then nothing is changed.
|
-- wax the block. This is the only viable usage of honeycomb's on_place. If it "fails" to wax, then nothing is changed.
|
||||||
return mcl_honey.wax_block(pos, node, placer, itemstack)
|
return mcl_honey.wax_block(pos, node, placer, itemstack, pointed_thing)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -410,6 +410,16 @@ local function make_stripped_trunk(itemstack, placer, pointed_thing)
|
||||||
if noddef._mcl_stripped_variant == nil then
|
if noddef._mcl_stripped_variant == nil then
|
||||||
return itemstack
|
return itemstack
|
||||||
else
|
else
|
||||||
|
if noddef.groups.door == 1 then
|
||||||
|
local pt_under = pointed_thing.under
|
||||||
|
if node_name:find("_b_") then
|
||||||
|
local top_pos = {x = pt_under.x, y = pt_under.y + 1, z = pt_under.z}
|
||||||
|
minetest.swap_node(top_pos, {name=noddef._mcl_stripped_variant:gsub("_b_", "_t_")})
|
||||||
|
elseif node_name:find("_t_") then
|
||||||
|
local bot_pos = {x = pt_under.x, y = pt_under.y - 1, z = pt_under.z}
|
||||||
|
minetest.swap_node(bot_pos, {name=noddef._mcl_stripped_variant:gsub("_t_", "_b_")})
|
||||||
|
end
|
||||||
|
end
|
||||||
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
|
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")
|
||||||
|
|
Loading…
Reference in New Issue