X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Ftool.cpp;h=40bcdc69a59616825d1607a925544164e691897d;hb=569fca53089b7b7e87b02edd44e2ad47166f7af6;hp=da7ee73dc5124fc2d05e810c05eaa1bea57ec34a;hpb=f1cb91cd931bed056bdbe37938d141e2ea068b89;p=minetest.git diff --git a/src/tool.cpp b/src/tool.cpp index da7ee73dc..40bcdc69a 100644 --- a/src/tool.cpp +++ b/src/tool.cpp @@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "utility.h" #include "itemdef.h" // For itemgroup_get() #include "log.h" +#include "inventory.h" void ToolCapabilities::serialize(std::ostream &os) const { @@ -74,12 +75,12 @@ DigParams getDigParams(const ItemGroupList &groups, //infostream<<"getDigParams"<name == "")) + do_hit = false; + } + if(do_hit){ + if(itemgroup_get(armor_groups, "immortal")) + do_hit = false; + } + } + + PunchDamageResult result; + if(do_hit) + { + HitParams hitparams = getHitParams(armor_groups, toolcap, + time_from_last_punch); + result.did_punch = true; + result.wear = hitparams.wear; + result.damage = hitparams.hp; + } + + return result; +} + +