[Mod] Minecraft like item drop/pick up [item_drop]

User avatar
Calinou
Moderator
Posts: 3162
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by Calinou » Post

MirceaKitsune wrote:I checked out the latest GIT version, and found an obvious problem: You can no longer drop items, because they're picked back up immediately after leaving your inventory. Can some sort of cooldown be added, so items can only be picked up a second after their entity appears in-world?
The version included in Carbone fixed this by removing the y offset in the check and reducing the collection radius, no timer is required: http://paste.ubuntu.com/7649710/

Uncomment the lines at the bottom to enable nodes dropping when they're dug.

User avatar
MirceaKitsune
Member
Posts: 867
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by MirceaKitsune » Post

Calinou wrote:The version included in Carbone fixed this by removing the y offset in the check and reducing the collection radius, no timer is required: http://paste.ubuntu.com/7649710/

Uncomment the lines at the bottom to enable nodes dropping when they're dug.
Good to know, thanks. Since this is a major problem, I hope it's fixed here too... being the original mod and all.

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by 4aiman » Post

+1
FM is affected too.

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by PilzAdam » Post

MirceaKitsune wrote:I checked out the latest GIT version, and found an obvious problem: You can no longer drop items, because they're picked back up immediately after leaving your inventory. Can some sort of cooldown be added, so items can only be picked up a second after their entity appears in-world?
There is a cooldown for that reason, maybe RBA broke it with his latest changes to builtin items (feel free to file an issue in the Minetest repo for that).

ivalin

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by ivalin » Post

Is this mod still being developed ? On minetest 0.4.10 can't drop items from my inventory or with " Q " button .

User avatar
LionsDen
Member
Posts: 530
Joined: Thu Jun 06, 2013 03:19

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by LionsDen » Post

I created the code for a trash can and posted it at the following link. It is not a mod, you need to create the depends.txt file and assign an image to use and put it into a mod directory. Looking at some other "simple" mods will show you what is needed. Here is the link:

viewtopic.php?p=148244#p148244

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by Evergreen » Post

LionsDen wrote:I created the code for a trash can and posted it at the following link. It is not a mod, you need to create the depends.txt file and assign an image to use and put it into a mod directory. Looking at some other "simple" mods will show you what is needed. Here is the link:

viewtopic.php?p=148244#p148244
I have a trash can mod too. :P

User avatar
meldrian
Member
Posts: 46
Joined: Sat Jan 12, 2013 14:02
GitHub: meldrian
IRC: meldrian
In-game: meldrian
Location: Germany
Contact:

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by meldrian » Post

ivalin wrote:Is this mod still being developed ? On minetest 0.4.10 can't drop items from my inventory or with " Q " button .
Jepp, got the same issue but you know what? I can handle it somehow :)
It's still a great and nearly necessary modification. Thank you PilzAdam

User avatar
gsmanners
Member
Posts: 159
Joined: Fri Jan 10, 2014 21:37

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by gsmanners » Post

Well, I have a "fix" (fwiw):

Code: Select all

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)

sloantothebone
Member
Posts: 26
Joined: Thu Aug 28, 2014 18:42

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by sloantothebone » Post

I tried out the fix but i get an error <eof> expected near end

User avatar
valmet565
Member
Posts: 12
Joined: Sat Nov 02, 2013 19:22
Location: Finland

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by valmet565 » Post

Fix works well. Replace only this function: "minetest.register_globalstep(function(dtime)". 71 lines.

User avatar
Joz
Member
Posts: 41
Joined: Fri Oct 25, 2013 21:37

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by Joz » Post

For me the line with "minetest.sound_play" doesn't work, also not with other sound files.

User avatar
fireglow
Member
Posts: 93
Joined: Fri Mar 28, 2014 11:36
IRC: fireglow
In-game: fireglow
Location: Germany

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by fireglow » Post

I, too, recommend the version of this mod that is shipped with Carbone: viewtopic.php?f=15&t=9033
It works as exptected!

rlocki69
New member
Posts: 3
Joined: Thu Nov 20, 2014 23:16
GitHub: rlocki69
IRC: rlocki69
In-game: rlocki69

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by rlocki69 » Post

Is there any way to break a block and not get the item dropped, but you can pick up blocks on the ground?

rlocki69
New member
Posts: 3
Joined: Thu Nov 20, 2014 23:16
GitHub: rlocki69
IRC: rlocki69
In-game: rlocki69

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by rlocki69 » Post

Whenever I try to drop an item, the sound plays but nothing happens.

User avatar
TailsTheFoxDoes MT
Member
Posts: 415
Joined: Mon Jan 18, 2016 20:50
In-game: TailsTheFox
Location: Mobius

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by TailsTheFoxDoes MT » Post

PilzAdam wrote:Hello everyone!
I have made a mod that adds Minecraft like item drop/pick up to Minetest. All you have to do is download and install the mod. Thats it!

License:
WTFPL applies to all parts

Dependencies:
None, you can use it with every mod/game/whatever.

GitHub:
https://github.com/PilzAdam/item_drop

Download:
https://github.com/PilzAdam/item_drop/zipball/master

Old versions:
I can't throw out items.
I'm the TailsTMM of minetest, in other words, i rock.
BRAAAAAZZZZAAAA!!!!!!!!!!!!!!!!!!!!!!!!!!!
BTW it means TailsTheMeseMinecart, but that isn't my name, it's just a way of saying that i basically do the same thing Dantdm does but i do it with minetest And you problably can't see the invisible ink.
My mods:
My first mod:tails_boss

Mob_pack now has voice acting! Do you want YOUR VOICE included? Look in my posts for the thread!

User avatar
qwertymine3
Member
Posts: 202
Joined: Wed Jun 03, 2015 14:33
GitHub: Qwertymine
In-game: qwertymine3

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by qwertymine3 » Post

TailsTheFoxDoes MT wrote: I can't throw out items.
This is a known issue with the mod.
If you search hard enough though, there are modified versions of this mod by other people which fix this bug.

e.g.
There is a modified version a few comments prior to this which allows the player to drop items if not moving.

The version from carbone, packaged as a seperate mod here viewtopic.php?t=9638. This allows dropping items at all times, but reduces the collection radius.

I (shameless plug) also have my own version as part of my water_physics modpack viewtopic.php?f=9&t=12722 (criminally bad search optimisation on my part - you can't find it while searching for item_drop through any search) mine also allows dropping items at all times. My version does remove the pretty attraction movement of the items to the player however.
Avatar by :devnko-ennekappao:

PureTryOut
Member
Posts: 12
Joined: Fri Oct 16, 2015 10:17
GitHub: PureTryOut
IRC: PureTryOut
In-game: PureTryOut

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by PureTryOut » Post

So am I right assuming it won't be fixed in this mod itself? Do I actually need a modified version?

User avatar
DoDoBirD
Member
Posts: 30
Joined: Fri Oct 21, 2016 23:33

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by DoDoBirD » Post

How come when trying to drop with my hotkey "Q" items won't drop?
I'm a noob. Deal with it.

User avatar
DoDoBirD
Member
Posts: 30
Joined: Fri Oct 21, 2016 23:33

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by DoDoBirD » Post

Found a "cure". When your inventory is full and you need to drop something, you can switch what you need with what you need to drop and click out of the inventory box like normal, and it'll drop. Hence the word cure.
I'm a noob. Deal with it.

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by texmex » Post

Like any aspiring modder, I'm making updates to PilzAdam's item_drop. There were a few deprecated calls I updated, as well as new features. If anyone sees more modernization opportunities, feel free to point them out.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
FreeGamers
Member
Posts: 602
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by FreeGamers » Post

I really enjoy this mod and using it on my server has been very positive.
Unfortunately I've come across a bug that is kicking all players from my server. It is creating a fatal error in the server. I notice it mostly happens when there are more than one players, I've created this bug with 3 players on my server pretty consistently.

Code: Select all

2019-05-24 18:18:44: WARNING[Server]: Undeclared global variable "can_pickup" accessed at /usr/share/games/minetest/mods/item_drop/init.lua:173
2019-05-24 18:18:44: ACTION[Main]: Server: Shutting down

Code: Select all

2019-05-24 18:57:09: WARNING[Server]: Undeclared global variable "can_pickup" accessed at /usr/share/games/minetest/mods/item_drop/init.lua:173
2019-05-24 18:57:09: ACTION[Main]: Server: Shutting down
2019-05-24 18:57:09: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod '' in callback environment_Step(): /usr/share/games/minetest/mods/item_drop/init.lua:173: attempt to call global$
2019-05-24 18:57:09: ERROR[Main]: stack traceback:
2019-05-24 18:57:09: ERROR[Main]:       /usr/share/games/minetest/mods/item_drop/init.lua:173: in function 'func'
2019-05-24 18:57:09: ERROR[Main]:       /usr/share/games/minetest/builtin/common/after.lua:18: in function </usr/share/games/minetest/builtin/common/after.lua:4>
2019-05-24 18:57:09: ERROR[Main]:       /usr/share/games/minetest/builtin/game/register.lua:419: in function </usr/share/games/minetest/builtin/game/register.lua:399>
I have two players that are usually working together and I've noticed they were mining coal (default:stone_with_coal) together when this kept happening. I see this error in other parts of my log that do not involve coal though. I've had to disable this mod for now. I'm not sure what is causing this error.

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by texmex » Post

@jeremyweston This specific mod isn’t updated anymore. Check out the newer, stabler version here: viewtopic.php?f=11&t=16913&p=255890#p255890
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
FreeGamers
Member
Posts: 602
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by FreeGamers » Post

texmex wrote:@jeremyweston This specific mod isn’t updated anymore. Check out the newer, stabler version here: viewtopic.php?f=11&t=16913&p=255890#p255890
Thanks, however, this issues does pertain to the version that you linked, I checked the source of both and I've incorrectly posted this error here instead of there.

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Minecraft like item drop/pick up [item_drop]

by texmex » Post

Lol, okay. Would you create an issues on the Github repo? We’ll look into it.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot] and 7 guests