From 5895152c60db53f09e9088252b27925d4b5fecc8 Mon Sep 17 00:00:00 2001 From: Treer Date: Sun, 19 Sep 2021 00:49:29 +1000 Subject: [PATCH] Treasure: Nether pickaxe takes 10x less wear damage when mining netherrack cracky-3 mining time of Nether pickaxe reduced from 0.4 to 0.3 to mine netherrack faster. maxlevel of nether pickaxe dropped from 3 to 2 to increase wear damage with non-netherrack nodes. --- nodes.lua | 6 ++++-- tools.lua | 21 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/nodes.lua b/nodes.lua index a13d0cc..f82559f 100644 --- a/nodes.lua +++ b/nodes.lua @@ -71,7 +71,8 @@ minetest.register_node("nether:rack", { description = S("Netherrack"), tiles = {"nether_rack.png"}, is_ground_content = true, - groups = {cracky = 3, level = 2}, + -- setting workable_with_nether_tools reduces the wear on nether:pick_nether when mining this node + groups = {cracky = 3, level = 2, workable_with_nether_tools = 3}, sounds = default.node_sound_stone_defaults(), }) @@ -81,7 +82,8 @@ minetest.register_node("nether:rack_deep", { _doc_items_longdesc = S("Netherrack from deep in the mantle"), tiles = {"nether_rack_deep.png"}, is_ground_content = true, - groups = {cracky = 3, level = 2}, + -- setting workable_with_nether_tools reduces the wear on nether:pick_nether when mining this node + groups = {cracky = 3, level = 2, workable_with_nether_tools = 3}, sounds = default.node_sound_stone_defaults(), }) diff --git a/tools.lua b/tools.lua index 26e1425..b821f07 100644 --- a/tools.lua +++ b/tools.lua @@ -20,18 +20,33 @@ local S = nether.get_translator minetest.register_tool("nether:pick_nether", { - description = S("Nether Pickaxe"), + description = S("Nether Pickaxe\nWell suited for mining netherrack"), + _doc_items_longdesc = S("Uniquely suited for mining netherrack, with minimal wear when doing so. Blunts quickly on other materials."), inventory_image = "nether_tool_netherpick.png", tool_capabilities = { full_punch_interval = 0.8, max_drop_level=3, groupcaps={ - cracky = {times={[1]=1.90, [2]=0.9, [3]=0.4}, uses=35, maxlevel=3}, + cracky = {times={[1]=1.90, [2]=0.9, [3]=0.3}, uses=35, maxlevel=2}, }, damage_groups = {fleshy=4}, }, sound = {breaks = "default_tool_breaks"}, - groups = {pickaxe = 1} + groups = {pickaxe = 1}, + + after_use = function(itemstack, user, node, digparams) + local wearDivisor = 1 + local nodeDef = minetest.registered_nodes[node.name] + if nodeDef ~= nil and nodeDef.groups ~= nil then + -- The nether pick hardly wears out when mining netherrack + local workable = nodeDef.groups.workable_with_nether_tools or 0 + wearDivisor = 1 + (3 * workable) -- 10 for netherrack, 1 otherwise. Making it able to mine 350 netherrack nodes, instead of 35. + end + + local wear = math.floor(digparams.wear / wearDivisor) + itemstack:add_wear(wear) -- apply the adjusted wear as usual + return itemstack + end }) minetest.register_tool("nether:shovel_nether", {