From 06699c2cc4b62a0bde7c4d8c1bd09e48c6c85323 Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 17 Apr 2021 11:55:50 +0000 Subject: [PATCH 1/2] Fix that an ax wears out if you right-click another block --- mods/ITEMS/mcl_tools/init.lua | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index fa5352c2c..3aebafb7b 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -352,7 +352,14 @@ minetest.register_tool("mcl_tools:shovel_diamond", { }) -- Axes - +local make_stripped_trunk_add_wear = function(itemstack, placer) + if not minetest.is_creative_enabled(placer:get_player_name()) then + -- Add wear (as if digging a axey node) + local toolname = itemstack:get_name() + local wear = mcl_autogroup.get_wear(toolname, "axey") + itemstack:add_wear(wear) + end +end local make_stripped_trunk = function(itemstack, placer, pointed_thing) if pointed_thing.type == "node" then local pos = minetest.get_pointed_thing_position(pointed_thing) @@ -367,36 +374,42 @@ local make_stripped_trunk = function(itemstack, placer, pointed_thing) minetest.record_protection_violation(pointed_thing.under, placer:get_player_name()) return itemstack end - if not minetest.is_creative_enabled(placer:get_player_name()) then - -- Add wear (as if digging a axey node) - local toolname = itemstack:get_name() - local wear = mcl_autogroup.get_wear(toolname, "axey") - itemstack:add_wear(wear) - end if node_name == "mcl_core:tree" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak"}) + make_stripped_trunk_add_wear(itemstack, placer) elseif node_name == "mcl_core:darktree" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak"}) + make_stripped_trunk_add_wear(itemstack, placer) elseif node_name == "mcl_core:acaciatree" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia"}) + make_stripped_trunk_add_wear(itemstack, placer) elseif node_name == "mcl_core:birchtree" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch"}) + make_stripped_trunk_add_wear(itemstack, placer) elseif node_name == "mcl_core:sprucetree" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce"}) + make_stripped_trunk_add_wear(itemstack, placer) elseif node_name == "mcl_core:jungletree" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle"}) + make_stripped_trunk_add_wear(itemstack, placer) elseif node_name == "mcl_core:tree_bark" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak_bark"}) + make_stripped_trunk_add_wear(itemstack, placer) elseif node_name == "mcl_core:darktree_bark" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak_bark"}) + make_stripped_trunk_add_wear(itemstack, placer) elseif node_name == "mcl_core:acaciatree_bark" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia_bark"}) + make_stripped_trunk_add_wear(itemstack, placer) elseif node_name == "mcl_core:birchtree_bark" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch_bark"}) + make_stripped_trunk_add_wear(itemstack, placer) elseif node_name == "mcl_core:sprucetree_bark" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce_bark"}) + make_stripped_trunk_add_wear(itemstack, placer) elseif node_name == "mcl_core:jungletree_bark" then minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle_bark"}) + make_stripped_trunk_add_wear(itemstack, placer) end end return itemstack From 5c928575f87980c20a0403033acae373d3ef7857 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sat, 17 Apr 2021 18:15:45 +0200 Subject: [PATCH 2/2] Fix #1572, server crash during login --- mods/PLAYER/mcl_playerplus/init.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 8dad7b2c5..b14d34824 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -183,10 +183,11 @@ minetest.register_globalstep(function(dtime) player_vel_yaw = limit_vel_yaw(player_vel_yaw, yaw) player_vel_yaws[name] = player_vel_yaw - if minetest.get_node_or_nil({x=player:get_pos().x, y=player:get_pos().y - 0.5, z=player:get_pos().z}) then - node_stand_return = minetest.get_node_or_nil({x=player:get_pos().x, y=player:get_pos().y - 0.1, z=player:get_pos().z}).name - else - minetest.log("action", "somehow player got of loaded areas") + local pos = player:get_pos() + local node = minetest.get_node_or_nil({x = pos.x, y = pos.y - 0.5, z = pos.z}) + + if node then + node_stand_return = node.name end local chestplate = player:get_inventory():get_stack("armor", 3)