From 54563262f6e6a72d7d60c2d74a3e47e6bb4b13b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Wed, 17 Mar 2021 17:09:19 +0100 Subject: [PATCH] Make tools without toolcaps do damage as hand If the tool_capabilities defaults to {} if unspecified the tool, then users will not be able to attack with the tool at all. This solves that by including the damage_group and full_punch_interval from the hand into the tool_capabilities when it is nil. --- mods/CORE/_mcl_autogroup/init.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mods/CORE/_mcl_autogroup/init.lua b/mods/CORE/_mcl_autogroup/init.lua index 7b2c275d..86bef08b 100644 --- a/mods/CORE/_mcl_autogroup/init.lua +++ b/mods/CORE/_mcl_autogroup/init.lua @@ -249,7 +249,14 @@ local function get_tool_capabilities(tdef) if tdef.tool_capabilities then return tdef.tool_capabilities end - return {} + + -- If the damage group and punch interval from hand is not included, + -- then the user will not be able to attack with the tool. + local hand_toolcaps = minetest.registered_tools[""].tool_capabilities + return { + full_punch_interval = hand_toolcaps.full_punch_interval, + damage_groups = hand_toolcaps.damage_groups + } end -- Get the groupcaps for a tool. This function returns "groupcaps" table of