version 0.21
This commit is contained in:
parent
bd1233aaf1
commit
c8d70b992c
1717 changed files with 68882 additions and 0 deletions
42
mods/item_drop/README.txt
Normal file
42
mods/item_drop/README.txt
Normal file
|
@ -0,0 +1,42 @@
|
|||
===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.
|
73
mods/item_drop/init.lua
Normal file
73
mods/item_drop/init.lua
Normal file
|
@ -0,0 +1,73 @@
|
|||
minetest.register_globalstep(function(dtime)
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
if player:get_hp() > 0 or not minetest.setting_getbool("enable_damage") then
|
||||
local pos = player:getpos()
|
||||
pos.y = pos.y+0.5
|
||||
local inv = player:get_inventory()
|
||||
local ctrl = player:get_player_control()
|
||||
if ctrl.up or ctrl.left or ctrl.right then
|
||||
|
||||
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do
|
||||
local en = object:get_luaentity()
|
||||
if not object:is_player() and en and en.name == "__builtin:item" then
|
||||
if inv and
|
||||
inv:room_for_item("main", ItemStack(en.itemstring)) then
|
||||
inv:add_item("main", ItemStack(en.itemstring))
|
||||
if en.itemstring ~= "" then
|
||||
minetest.sound_play("item_drop_pickup", {
|
||||
to_player = player:get_player_name(),
|
||||
gain = 0.4,
|
||||
})
|
||||
end
|
||||
en.itemstring = ""
|
||||
object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function minetest.handle_node_drops(pos, drops, digger)
|
||||
local inv
|
||||
if minetest.setting_getbool("creative_mode") and digger and digger:is_player() then
|
||||
inv = digger:get_inventory()
|
||||
end
|
||||
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
|
||||
if not inv or not inv:contains_item("main", ItemStack(name)) then
|
||||
for i=1,count do
|
||||
local obj = minetest.env:add_item(pos, name)
|
||||
if obj ~= nil then
|
||||
obj:get_luaentity().collect = true
|
||||
local x = math.random(1, 5)
|
||||
if math.random(1,2) == 1 then
|
||||
x = -x
|
||||
end
|
||||
local z = math.random(1, 5)
|
||||
if math.random(1,2) == 1 then
|
||||
z = -z
|
||||
end
|
||||
obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
|
||||
|
||||
-- FIXME this doesnt work for deactiveted objects
|
||||
if minetest.setting_get("remove_items") and tonumber(minetest.setting_get("remove_items")) then
|
||||
minetest.after(tonumber(minetest.setting_get("remove_items")), function(obj)
|
||||
obj:remove()
|
||||
end, obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
BIN
mods/item_drop/sounds/item_drop_pickup.1.ogg
Normal file
BIN
mods/item_drop/sounds/item_drop_pickup.1.ogg
Normal file
Binary file not shown.
BIN
mods/item_drop/sounds/item_drop_pickup.2.ogg
Normal file
BIN
mods/item_drop/sounds/item_drop_pickup.2.ogg
Normal file
Binary file not shown.
BIN
mods/item_drop/sounds/item_drop_pickup.3.ogg
Normal file
BIN
mods/item_drop/sounds/item_drop_pickup.3.ogg
Normal file
Binary file not shown.
BIN
mods/item_drop/sounds/item_drop_pickup.4.ogg
Normal file
BIN
mods/item_drop/sounds/item_drop_pickup.4.ogg
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue