Infinite tools in creative mode
authorLord89James <neftali_dtctv@hotmail.com>
Mon, 11 Mar 2013 12:36:04 +0000 (13:36 +0100)
committerPilzAdam <pilzadam@minetest.net>
Tue, 2 Jul 2013 00:33:31 +0000 (00:33 +0000)
builtin/item.lua

index 85b4cc0e42e242bcb205bba9e5d96f50a3c5bc13..799e46f7375cca9fcd1053be7c1a9d5007ab929e 100644 (file)
@@ -330,10 +330,12 @@ function minetest.node_dig(pos, node, digger)
        local drops = minetest.get_node_drops(node.name, wielded:get_name())
 
        -- Wear out tool
-       local tp = wielded:get_tool_capabilities()
-       local dp = minetest.get_dig_params(def.groups, tp)
-       wielded:add_wear(dp.wear)
-       digger:set_wielded_item(wielded)
+       if not minetest.setting_getbool("creative_mode") then
+               local tp = wielded:get_tool_capabilities()
+               local dp = minetest.get_dig_params(def.groups, tp)
+               wielded:add_wear(dp.wear)
+               digger:set_wielded_item(wielded)
+       end
        
        -- Handle drops
        minetest.handle_node_drops(pos, drops, digger)