]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Allow toolcaps to override the built-in times for dig_immediate
authorsfan5 <sfan5@live.de>
Tue, 30 Jul 2019 15:18:37 +0000 (17:18 +0200)
committersfan5 <sfan5@live.de>
Wed, 31 Jul 2019 16:28:21 +0000 (18:28 +0200)
src/tool.cpp

index becb574b0b3d18b9aad74ff7e44c7b0c681ea1a2..09b876ae0fa5d6aaf0bbd84bae9b048ec4293d1a 100644 (file)
@@ -172,14 +172,16 @@ void ToolCapabilities::deserializeJson(std::istream &is)
 DigParams getDigParams(const ItemGroupList &groups,
                const ToolCapabilities *tp)
 {
-       // Group dig_immediate has fixed time and no wear
-       switch (itemgroup_get(groups, "dig_immediate")) {
-       case 2:
-               return DigParams(true, 0.5, 0, "dig_immediate");
-       case 3:
-               return DigParams(true, 0, 0, "dig_immediate");
-       default:
-               break;
+       // Group dig_immediate defaults to fixed time and no wear
+       if (tp->groupcaps.find("dig_immediate") == tp->groupcaps.cend()) {
+               switch (itemgroup_get(groups, "dig_immediate")) {
+               case 2:
+                       return DigParams(true, 0.5, 0, "dig_immediate");
+               case 3:
+                       return DigParams(true, 0, 0, "dig_immediate");
+               default:
+                       break;
+               }
        }
 
        // Values to be returned (with a bit of conversion)