Move Waxing function to MCL_Honey. Remove commented code.

This commit is contained in:
Michieal 2023-02-04 03:31:11 -05:00
parent 08610296fc
commit c4e4a8e4d2
3 changed files with 23 additions and 68 deletions

View File

@ -1,34 +1,5 @@
--local deepslate_mod = minetest.get_modpath("mcl_deepslate") --local deepslate_mod = minetest.get_modpath("mcl_deepslate")
--[[ a basic on_place()
function mcl_copper.on_place (itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
local node = minetest.get_node(pointed_thing.under)
local pos = pointed_thing.under
local node_name = node.name
if mcl_util.check_position_protection(pos, placer) then
return itemstack
end
-- Use pointed node's on_rightclick function first, if present
local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing)
if new_stack then
return new_stack
end
local placed = ItemStack(itemstack:get_name())
if not minetest.is_creative_enabled(placer:get_player_name()) then
itemstack:take_item()
end
minetest.item_place(placed, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under)))
return itemstack
end
--]]
local function register_oxidation_abm(abm_name, node_name, oxidized_variant) local function register_oxidation_abm(abm_name, node_name, oxidized_variant)
minetest.register_abm({ minetest.register_abm({
label = abm_name, label = abm_name,
@ -41,26 +12,6 @@ local function register_oxidation_abm(abm_name, node_name, oxidized_variant)
}) })
end end
function mcl_copper.waxing_copper_block(pos, node, player, itemstack)
-- prevent modification of protected nodes.
if mcl_util.check_position_protection(pos, player) then
return
end
local def = minetest.registered_nodes[node.name]
if def and def._mcl_copper_waxed_variant then
node.name = def._mcl_copper_waxed_variant
end
minetest.set_node(pos, node)
awards.unlock(player:get_player_name(), "mcl:wax_on")
if not minetest.is_creative_enabled(player:get_player_name()) then
itemstack:take_item()
end
return itemstack
end
--[[ --[[
local stairs = { local stairs = {
{"stair", "exposed", "_inner", "cut_inner"}, {"stair", "exposed", "_inner", "cut_inner"},

View File

@ -35,7 +35,6 @@ minetest.register_node("mcl_copper:block", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_copper_waxed_variant = "mcl_copper:waxed_block", _mcl_copper_waxed_variant = "mcl_copper:waxed_block",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:waxed_block", { minetest.register_node("mcl_copper:waxed_block", {
@ -48,7 +47,6 @@ minetest.register_node("mcl_copper:waxed_block", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_stripped_variant = "mcl_copper:block", _mcl_stripped_variant = "mcl_copper:block",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:block_exposed", { minetest.register_node("mcl_copper:block_exposed", {
@ -62,7 +60,6 @@ minetest.register_node("mcl_copper:block_exposed", {
_mcl_hardness = 5, _mcl_hardness = 5,
_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",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:waxed_block_exposed", { minetest.register_node("mcl_copper:waxed_block_exposed", {
@ -75,7 +72,6 @@ minetest.register_node("mcl_copper:waxed_block_exposed", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_stripped_variant = "mcl_copper:block", _mcl_stripped_variant = "mcl_copper:block",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:block_weathered", { minetest.register_node("mcl_copper:block_weathered", {
@ -89,7 +85,6 @@ minetest.register_node("mcl_copper:block_weathered", {
_mcl_hardness = 5, _mcl_hardness = 5,
_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",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:waxed_block_weathered", { minetest.register_node("mcl_copper:waxed_block_weathered", {
@ -102,7 +97,6 @@ minetest.register_node("mcl_copper:waxed_block_weathered", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_stripped_variant = "mcl_copper:block_exposed", _mcl_stripped_variant = "mcl_copper:block_exposed",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:block_oxidized", { minetest.register_node("mcl_copper:block_oxidized", {
@ -116,7 +110,6 @@ minetest.register_node("mcl_copper:block_oxidized", {
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_copper_waxed_variant = "mcl_copper:waxed_block_oxidized", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_oxidized",
_mcl_stripped_variant = "mcl_copper:block_weathered", _mcl_stripped_variant = "mcl_copper:block_weathered",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:waxed_block_oxidized", { minetest.register_node("mcl_copper:waxed_block_oxidized", {
@ -129,7 +122,6 @@ minetest.register_node("mcl_copper:waxed_block_oxidized", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_stripped_variant = "mcl_copper:block_weathered", _mcl_stripped_variant = "mcl_copper:block_weathered",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:block_cut", { minetest.register_node("mcl_copper:block_cut", {
@ -142,7 +134,6 @@ minetest.register_node("mcl_copper:block_cut", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_copper_waxed_variant = "mcl_copper:waxed_block_cut", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_cut",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:waxed_block_cut", { minetest.register_node("mcl_copper:waxed_block_cut", {
@ -155,7 +146,6 @@ minetest.register_node("mcl_copper:waxed_block_cut", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_stripped_variant = "mcl_copper:block_cut", _mcl_stripped_variant = "mcl_copper:block_cut",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:block_exposed_cut", { minetest.register_node("mcl_copper:block_exposed_cut", {
@ -169,7 +159,6 @@ minetest.register_node("mcl_copper:block_exposed_cut", {
_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_stripped_variant = "mcl_copper:block_cut", _mcl_stripped_variant = "mcl_copper:block_cut",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:waxed_block_exposed_cut", { minetest.register_node("mcl_copper:waxed_block_exposed_cut", {
@ -182,7 +171,6 @@ minetest.register_node("mcl_copper:waxed_block_exposed_cut", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
_mcl_stripped_variant = "mcl_copper:block_cut", _mcl_stripped_variant = "mcl_copper:block_cut",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:block_weathered_cut", { minetest.register_node("mcl_copper:block_weathered_cut", {
@ -196,7 +184,6 @@ 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_copper_waxed_variant = "mcl_copper:waxed_block_weathered_cut", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered_cut",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:waxed_block_weathered_cut", { minetest.register_node("mcl_copper:waxed_block_weathered_cut", {
@ -209,7 +196,6 @@ minetest.register_node("mcl_copper:waxed_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",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:block_oxidized_cut", { minetest.register_node("mcl_copper:block_oxidized_cut", {
@ -223,7 +209,6 @@ minetest.register_node("mcl_copper:block_oxidized_cut", {
_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_copper_waxed_variant = "mcl_copper:waxed_block_oxidized_cut",
--on_place = mcl_copper.on_place,
}) })
minetest.register_node("mcl_copper:waxed_block_oxidized_cut", { minetest.register_node("mcl_copper:waxed_block_oxidized_cut", {
@ -236,7 +221,6 @@ minetest.register_node("mcl_copper:waxed_block_oxidized_cut", {
_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",
--on_place = mcl_copper.on_place,
}) })
mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut", mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut",

View File

@ -1,11 +1,33 @@
--------------- ---------------
---- Honey ---- ---- Honey ----
--------------- ---------------
mcl_honey = {}
-- Variables -- Variables
local S = minetest.get_translator(minetest.get_current_modname()) 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
function mcl_honey.wax_block(pos, node, player, itemstack)
-- prevent modification of protected nodes.
if mcl_util.check_position_protection(pos, player) then
return
end
local def = minetest.registered_nodes[node.name]
if def and def._mcl_copper_waxed_variant then
node.name = def._mcl_copper_waxed_variant
end
minetest.set_node(pos, node)
awards.unlock(player:get_player_name(), "mcl:wax_on")
if not minetest.is_creative_enabled(player:get_player_name()) then
itemstack:take_item()
end
return itemstack
end
-- Honeycomb -- Honeycomb
minetest.register_craftitem("mcl_honey:honeycomb", { minetest.register_craftitem("mcl_honey:honeycomb", {
description = S("Honeycomb"), description = S("Honeycomb"),
@ -21,14 +43,12 @@ minetest.register_craftitem("mcl_honey:honeycomb", {
local pos = pointed_thing.under local pos = pointed_thing.under
local node_name = node.name local node_name = node.name
if minetest.get_modpath("mcl_copper") and mcl_copper then
local def = minetest.registered_nodes[node_name] local def = minetest.registered_nodes[node_name]
if def and def._mcl_copper_waxed_variant then if def and def._mcl_copper_waxed_variant then
-- wax the copper block. -- wax the copper block.
return mcl_copper.waxing_copper_block(pos, node, placer, itemstack) return mcl_honey.wax_block(pos, node, placer, itemstack)
end end
end
end, end,
}) })