Allow any character in formspec strings with escape char
[oweals/minetest.git] / builtin / item.lua
index 2233b6c5b8ccae595c63120fce671e252be8145b..1349fdf63834d133bbb0cf46a5ce22c5a1cc8065 100644 (file)
@@ -243,9 +243,8 @@ function minetest.item_place(itemstack, placer, pointed_thing)
 
        if itemstack:get_definition().type == "node" then
                return minetest.item_place_node(itemstack, placer, pointed_thing)
-       elseif itemstack:get_definition().type ~= "none" then
-               return minetest.item_place_object(itemstack, placer, pointed_thing)
        end
+       return itemstack
 end
 
 function minetest.item_drop(itemstack, dropper, pos)
@@ -291,7 +290,15 @@ function minetest.handle_node_drops(pos, drops, digger)
        if digger:get_inventory() then
                local _, dropped_item
                for _, dropped_item in ipairs(drops) do
-                       digger:get_inventory():add_item("main", dropped_item)
+                       local left = digger:get_inventory():add_item("main", dropped_item)
+                       if not left:is_empty() then
+                               local p = {
+                                       x = pos.x + math.random()/2-0.25,
+                                       y = pos.y + math.random()/2-0.25,
+                                       z = pos.z + math.random()/2-0.25,
+                               }
+                               minetest.env:add_item(p, left)
+                       end
                end
        end
 end