diff options
author | sfan5 <sfan5@live.de> | 2019-07-30 17:18:37 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-07-31 18:28:21 +0200 |
commit | 3296952ae55231d601686b69c037ec1366381fc5 (patch) | |
tree | b998748e72c1946e9b0089bbbcd3a62aaa28e99c /src | |
parent | 245e628d401e421abc512ee0c3b057735fbccaea (diff) | |
download | minetest-3296952ae55231d601686b69c037ec1366381fc5.tar.gz minetest-3296952ae55231d601686b69c037ec1366381fc5.tar.bz2 minetest-3296952ae55231d601686b69c037ec1366381fc5.zip |
Allow toolcaps to override the built-in times for dig_immediate
Diffstat (limited to 'src')
-rw-r--r-- | src/tool.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/tool.cpp b/src/tool.cpp index becb574b0..09b876ae0 100644 --- a/src/tool.cpp +++ b/src/tool.cpp @@ -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) |