aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/item.lua32
1 files changed, 15 insertions, 17 deletions
diff --git a/builtin/item.lua b/builtin/item.lua
index 2a9b4ff27..1b4b4d25a 100644
--- a/builtin/item.lua
+++ b/builtin/item.lua
@@ -273,25 +273,23 @@ function minetest.node_dig(pos, node, digger)
minetest.log('action', digger:get_player_name() .. " digs "
.. node.name .. " at " .. minetest.pos_to_string(pos))
- if not minetest.setting_getbool("creative_mode") then
- local wielded = digger:get_wielded_item()
- 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)
-
- -- Add dropped items to object's inventory
- if digger:get_inventory() then
- local _, dropped_item
- for _, dropped_item in ipairs(drops) do
- digger:get_inventory():add_item("main", dropped_item)
- end
+ local wielded = digger:get_wielded_item()
+ 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)
+
+ -- Add dropped items to object's inventory
+ if digger:get_inventory() then
+ local _, dropped_item
+ for _, dropped_item in ipairs(drops) do
+ digger:get_inventory():add_item("main", dropped_item)
end
end
-
+
local oldmetadata = nil
if def.after_dig_node then
oldmetadata = minetest.env:get_meta(pos):to_table()