2012-10-30 21:10:03 +06:00
|
|
|
--Mod by PilzAdam
|
|
|
|
|
2012-10-14 23:52:41 +06:00
|
|
|
function minetest.handle_node_drops(pos, drops, digger)
|
|
|
|
for _,item in ipairs(drops) do
|
|
|
|
local count, name
|
|
|
|
if type(item) == "string" then
|
|
|
|
count = 1
|
|
|
|
name = item
|
|
|
|
else
|
|
|
|
count = item:get_count()
|
|
|
|
name = item:get_name()
|
|
|
|
end
|
|
|
|
for i=1,count do
|
|
|
|
local obj = minetest.env:add_item(pos, name)
|
|
|
|
if obj ~= nil then
|
|
|
|
obj:get_luaentity().collect = true
|
2012-10-31 18:36:51 +06:00
|
|
|
local k = 1
|
|
|
|
if name == "default:cobble" then
|
|
|
|
k = math.random(3,6)
|
|
|
|
end
|
|
|
|
local x = math.random(1, 5)/k
|
2012-10-14 23:52:41 +06:00
|
|
|
if math.random(1,2) == 1 then
|
|
|
|
x = -x
|
|
|
|
end
|
2012-10-31 18:36:51 +06:00
|
|
|
local z = math.random(1, 5)/k
|
2012-10-14 23:52:41 +06:00
|
|
|
if math.random(1,2) == 1 then
|
|
|
|
z = -z
|
|
|
|
end
|
|
|
|
obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|