From 5c9695e242d3972b8503039bf8775e27699c57a4 Mon Sep 17 00:00:00 2001 From: Vitaliy Olkhin Date: Sun, 10 Nov 2024 16:33:51 +0500 Subject: [PATCH] Added a lock to the tool node destroyer to prevent the stone block from being destroyed. This need was removed from stone generation if a sieve-type mod is used on the server. --- default_settings.lua | 1 + luaentity.lua | 2 +- settingtypes.txt | 4 ++++ wielder.lua | 8 ++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/default_settings.lua b/default_settings.lua index 6861022..48a8a6e 100644 --- a/default_settings.lua +++ b/default_settings.lua @@ -32,6 +32,7 @@ local settings = { use_real_entities = true, entity_update_interval = 0, enable_vertical_digilines_connectivity = true, + enable_node_destroyer_from_tool = true, enable_debug = false, } diff --git a/luaentity.lua b/luaentity.lua index 9aa2638..6f54e71 100644 --- a/luaentity.lua +++ b/luaentity.lua @@ -365,7 +365,7 @@ local move_entities_globalstep_part2 = function(dtime) if object or entity.owner ~= nil then --minetest.chat_send_all("online: " .. dump(entity.owner)) if pipeworks.enable_debug then - minetest.log("action", "pipeworks: активная передача по трубам игрок в сети: " .. entity.owner) + minetest.log("action", "pipeworks: активная передача по трубам игрок в сети: " .. dump(entity.owner)) end local master = entity._attached_entities_master diff --git a/settingtypes.txt b/settingtypes.txt index 7783530..40053fb 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -101,4 +101,8 @@ pipeworks_log_teleport_tubes (Log Teleport Tubes) bool false # Set it to noop if you wish to disable that behavior. pipeworks_lua_tube_print_behavior (Behavior of print in Lua Tube) enum log log,noop +#Disconnect node destroyer from tool +pipeworks_enable_node_destroyer_from_tool = true + pipeworks_enable_debug (Enable debug) bool false + diff --git a/wielder.lua b/wielder.lua index 0850e5a..f05e63a 100644 --- a/wielder.lua +++ b/wielder.lua @@ -261,6 +261,14 @@ if pipeworks.enable_node_breaker then end -- Check if the tool can dig the node local tool = stack:get_tool_capabilities() + if pipeworks.enable_debug then + minetest.log("action", "pipeworks: tool: " .. dump(tool)) + end + + if tool.punch_attack_uses > 0 and pipeworks.enable_node_destroyer_from_tool == false then + return + end + if not minetest.get_dig_params(node_def.groups, tool).diggable then -- Try using hand if tool can't dig the node local hand = ItemStack():get_tool_capabilities()