Merge remote-tracking branch 'origin/drops' into trees

This commit is contained in:
Kotolegokot 2012-11-16 21:52:29 +06:00
parent e25ba616e9
commit f5353444d1
3 changed files with 28 additions and 44 deletions

View File

@ -1084,8 +1084,18 @@ function nodeupdate_single(p)
p_bottom = {x=p.x, y=p.y-1, z=p.z}
n_bottom = minetest.env:get_node(p_bottom)
if not minetest.registered_nodes[n_bottom.name].walkable and n_bottom.name ~= n.name then
local meta = minetest.env:get_meta(p)
if minetest.registered_nodes[n.name].on_dropping ~= nil then
minetest.registered_nodes[n.name].on_dropping(p, n, meta)
end
minetest.env:remove_node(p)
minetest.env:add_item(p, n.name)
local obj = minetest.env:add_item(p, n.name)
local x = math.random(-5,5)
local z = math.random(-5,5)
obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
if minetest.registered_nodes[n.name].after_dropping ~= nil then
minetest.registered_nodes[n.name].after_dropping(p, n, meta)
end
nodeupdate(p)
end
end

View File

@ -1,42 +0,0 @@
===ITEM_DROP MOD for MINETEST-C55===
by PilzAdam
Introduction:
This mod adds Minecraft like drop/pick up of items to Minetest.
How to install:
Unzip the archive an place it in minetest-base-directory/mods/minetest/
if you have a windows client or a linux run-in-place client. If you have
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
If you want to install this mod only in one world create the folder
worldmods/ in your worlddirectory.
For further information or help see:
http://wiki.minetest.com/wiki/Installing_Mods
How to use the mod:
Just install it an everything works.
For developers:
You dont have to use get_drops() anymore because of changes in the
builtin files of minetest.
License:
Sourcecode: WTFPL (see below)
Sound: WTFPL (see below)
See also:
http://minetest.net/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -1,7 +1,7 @@
--Mod by PilzAdam
function minetest.handle_node_drops(pos, drops, digger)
for _,item in ipairs(drops) do
local function drop(item)
local count, name
if type(item) == "string" then
count = 1
@ -30,4 +30,20 @@ function minetest.handle_node_drops(pos, drops, digger)
end
end
end
local function drop_all()
for _, item in ipairs(drops) do
drop(item)
end
end
if minetest.get_node_group(minetest.env:get_node(pos).name, "drop_on_dig") == 1 then
drop_all()
elseif digger:get_inventory() then
for _, dropped_item in ipairs(drops) do
if digger:get_inventory():room_for_item("main", dropped_item) then
digger:get_inventory():add_item("main", dropped_item)
else
drop(dropped_item)
end
end
end
end