pastebin

Paste #Ilp -- näytä pelkkänä tekstinä -- uusi tämän pohjalta

Värjäys: Tyyli: ensimmäinen rivinumero: Tabin korvaus:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
diff --git a/builtin/item.lua b/builtin/item.lua
index 4e3c744..0f8dcff 100644
--- a/builtin/item.lua
+++ b/builtin/item.lua
@@ -260,6 +260,16 @@ function minetest.node_punch(pos, node, puncher)
        end
 end
 
+function minetest.handle_node_drops(pos, drops, digger)
+       -- 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
+end
+
 function minetest.node_dig(pos, node, digger)
        minetest.debug("node_dig")
 
@@ -284,14 +294,9 @@ function minetest.node_dig(pos, node, digger)
        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
+       
+       -- Handle drops
+       minetest.handle_node_drops(pos, drops, digger)
 
        local oldmetadata = nil
        if def.after_dig_node then