From 50effaa807c350ff9a4dc9d6ff40bdd3e3ac159d Mon Sep 17 00:00:00 2001 From: Michieal Date: Fri, 3 Feb 2023 14:09:16 -0500 Subject: [PATCH] Made Requested changes from Pull Request. --- mods/ITEMS/mcl_copper/functions.lua | 39 +++++++++++++---------------- mods/ITEMS/mcl_copper/nodes.lua | 32 +++++++++++------------ mods/ITEMS/mcl_honey/init.lua | 36 +++++++++++++------------- 3 files changed, 52 insertions(+), 55 deletions(-) diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index c7cdb6472..2edb79b94 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -1,6 +1,6 @@ --local deepslate_mod = minetest.get_modpath("mcl_deepslate") --- a basic on_place() +--[[ a basic on_place() function mcl_copper.on_place (itemstack, placer, pointed_thing) if pointed_thing.type ~= "node" then return itemstack @@ -27,6 +27,7 @@ function mcl_copper.on_place (itemstack, placer, pointed_thing) return itemstack end +--]] local function register_oxidation_abm(abm_name, node_name, oxidized_variant) minetest.register_abm({ @@ -41,27 +42,23 @@ local function register_oxidation_abm(abm_name, node_name, oxidized_variant) end function mcl_copper.waxing_copper_block(pos, node, player, itemstack) - if itemstack:get_name() == "mcl_honey:honeycomb" then - -- 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 - else - return -- changed to work with mcl_util.call_on_rightclick() + -- 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 --[[ diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index ca3f563cf..15a5a0fd7 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -35,7 +35,7 @@ minetest.register_node("mcl_copper:block", { _mcl_blast_resistance = 6, _mcl_hardness = 3, _mcl_copper_waxed_variant = "mcl_copper:waxed_block", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:waxed_block", { @@ -48,7 +48,7 @@ minetest.register_node("mcl_copper:waxed_block", { _mcl_blast_resistance = 6, _mcl_hardness = 3, _mcl_stripped_variant = "mcl_copper:block", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:block_exposed", { @@ -62,7 +62,7 @@ minetest.register_node("mcl_copper:block_exposed", { _mcl_hardness = 5, _mcl_copper_waxed_variant = "mcl_copper:waxed_block_exposed", _mcl_stripped_variant = "mcl_copper:block", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:waxed_block_exposed", { @@ -75,7 +75,7 @@ minetest.register_node("mcl_copper:waxed_block_exposed", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:block_weathered", { @@ -89,7 +89,7 @@ minetest.register_node("mcl_copper:block_weathered", { _mcl_hardness = 5, _mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered", _mcl_stripped_variant = "mcl_copper:block_exposed", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:waxed_block_weathered", { @@ -102,7 +102,7 @@ minetest.register_node("mcl_copper:waxed_block_weathered", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block_exposed", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:block_oxidized", { @@ -116,7 +116,7 @@ minetest.register_node("mcl_copper:block_oxidized", { _mcl_hardness = 5, _mcl_copper_waxed_variant = "mcl_copper:waxed_block_oxidized", _mcl_stripped_variant = "mcl_copper:block_weathered", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:waxed_block_oxidized", { @@ -129,7 +129,7 @@ minetest.register_node("mcl_copper:waxed_block_oxidized", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block_weathered", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:block_cut", { @@ -142,7 +142,7 @@ minetest.register_node("mcl_copper:block_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_copper_waxed_variant = "mcl_copper:waxed_block_cut", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:waxed_block_cut", { @@ -155,7 +155,7 @@ minetest.register_node("mcl_copper:waxed_block_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block_cut", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:block_exposed_cut", { @@ -169,7 +169,7 @@ minetest.register_node("mcl_copper:block_exposed_cut", { _mcl_hardness = 5, _mcl_copper_waxed_variant = "mcl_copper:waxed_block_exposed_cut", _mcl_stripped_variant = "mcl_copper:block_cut", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:waxed_block_exposed_cut", { @@ -182,7 +182,7 @@ minetest.register_node("mcl_copper:waxed_block_exposed_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block_cut", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:block_weathered_cut", { @@ -196,7 +196,7 @@ minetest.register_node("mcl_copper:block_weathered_cut", { _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block_exposed_cut", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_weathered_cut", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:waxed_block_weathered_cut", { @@ -209,7 +209,7 @@ minetest.register_node("mcl_copper:waxed_block_weathered_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block_exposed_cut", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:block_oxidized_cut", { @@ -223,7 +223,7 @@ minetest.register_node("mcl_copper:block_oxidized_cut", { _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block_weathered_cut", _mcl_copper_waxed_variant = "mcl_copper:waxed_block_oxidized_cut", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) minetest.register_node("mcl_copper:waxed_block_oxidized_cut", { @@ -236,7 +236,7 @@ minetest.register_node("mcl_copper:waxed_block_oxidized_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_stripped_variant = "mcl_copper:block_weathered_cut", - on_place = mcl_copper.on_place, + --on_place = mcl_copper.on_place, }) mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut", diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index 7fbd0d322..e7f0a5adf 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -4,7 +4,7 @@ -- Variables 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 } } -- Honeycomb minetest.register_craftitem("mcl_honey:honeycomb", { @@ -22,11 +22,11 @@ minetest.register_craftitem("mcl_honey:honeycomb", { local node_name = node.name if minetest.get_modpath("mcl_copper") and mcl_copper then - if string.find(node_name,"mcl_copper") ~= nil then - if string.find(node_name,"waxed") == nil then - -- wax the copper block. - return mcl_copper.waxing_copper_block(pos, node, placer, itemstack) - end + local def = minetest.registered_nodes[node_name] + + if def and def._mcl_copper_waxed_variant then + -- wax the copper block. + return mcl_copper.waxing_copper_block(pos, node, placer, itemstack) end end end, @@ -40,10 +40,10 @@ minetest.register_node("mcl_honey:honeycomb_block", { }, groups = { handy = 1, deco_block = 1 }, sounds = { - dig = {name="slimenodes_dug", gain=0.6, pitch=1.2}, - dug = {name="slimenodes_dug", gain=0.6}, - place = {name="slimenodes_place", gain=0.6}, - footstep = {name="slimenodes_step", gain=0.3}, + dig = { name = "slimenodes_dug", gain = 0.6, pitch = 1.2 }, + dug = { name = "slimenodes_dug", gain = 0.6 }, + place = { name = "slimenodes_place", gain = 0.6 }, + footstep = { name = "slimenodes_step", gain = 0.3 }, }, _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, @@ -55,7 +55,7 @@ minetest.register_craftitem("mcl_honey:honey_bottle", { _doc_items_longdesc = S("Honey Bottle is used to craft honey blocks and to restore hunger points."), _doc_items_usagehelp = S("Drinking will restore 6 hunger points. Can also be used to craft honey blocks."), inventory_image = "mcl_honey_honey_bottle.png", - groups = { craftitem = 1, food = 3, eatable = 6, can_eat_when_full=1 }, + groups = { craftitem = 1, food = 3, eatable = 6, can_eat_when_full = 1 }, on_place = minetest.item_eat(6, "mcl_potions:glass_bottle"), on_secondary_use = minetest.item_eat(6, "mcl_potions:glass_bottle"), _mcl_saturation = 1.2, @@ -65,21 +65,21 @@ minetest.register_craftitem("mcl_honey:honey_bottle", { minetest.register_node("mcl_honey:honey_block", { description = S("Honey Block"), _doc_items_longdesc = S("Honey Block. Used as a decoration and in redstone. Is sticky on some sides."), - tiles = {"mcl_honey_block_side.png"}, + tiles = { "mcl_honey_block_side.png" }, use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "blend" or true, groups = { handy = 1, deco_block = 1, fall_damage_add_percent = -80 }, sounds = { - dug = {name="slimenodes_dug", gain=0.6}, - place = {name="slimenodes_place", gain=0.6}, - footstep = {name="slimenodes_step", gain=0.3}, + dug = { name = "slimenodes_dug", gain = 0.6 }, + place = { name = "slimenodes_place", gain = 0.6 }, + footstep = { name = "slimenodes_step", gain = 0.3 }, }, paramtype = "light", drawtype = "nodebox", node_box = { type = "fixed", fixed = { - {-0.4, -0.4, -0.4, 0.4, 0.4, 0.4}, - {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + { -0.4, -0.4, -0.4, 0.4, 0.4, 0.4 }, + { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, } }, selection_box = { @@ -107,7 +107,7 @@ minetest.register_node("mcl_honey:honey_block", { elseif name == "mesecons_pistons:piston_down_sticky_off" or name == "mesecons_pistons:piston_down_normal_off" then piston, piston_down = true, true end - if not( (piston_side and (n-1==neighbor_node.param2)) or (piston_up and (n==5)) or (piston_down and (n==6)) ) then + if not ((piston_side and (n - 1 == neighbor_node.param2)) or (piston_up and (n == 5)) or (piston_down and (n == 6))) then if piston and piston_pos then if piston_pos.x == neighbor_pos.x and piston_pos.y == neighbor_pos.y and piston_pos.z == neighbor_pos.z then -- Loopback to the same piston! Preventing unwanted behavior: