Page 2 of 3

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Wed Oct 03, 2018 08:39
by zasnool
Good to hear. I have downloaded the 5.0 version, having thought that it is the beta version and that the most mods won't work I didn't try to play it.
Tested this mod on 5.0 and it works well now. Thanks for the help.

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Wed Oct 03, 2018 09:51
by texmex
zasnool wrote:Good to hear. I have downloaded the 5.0 version, having thought that it is the beta version and that the most mods won't work I didn't try to play it.
Tested this mod on 5.0 and it works well now. Thanks for the help.
It sounds like you're coming from the Minecraft side of town. In Minetest it's the opposite: the vast majority of mods do work in newer versions. :D

You're welcome, thanks for using item_drop!

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Wed Oct 03, 2018 12:38
by zasnool
I ended up using 4.17 after all, some of the mods don't work quite well on the v5 of minetest. If anyone comes looking for the same problem solution here's what I did:
Set the magnet radius to -1, as it was by default and set the pickup radius to 2 blocks(or is it meters, i don;t know) you can set it to whatever you find comfortable. Sure, I don't have this nice little visual effect of items transitioning to the character, but at least I don't miss out on blocks that fall on the ground in close proximity(pickup radius value), like, for example, tree saplings that fall from the tree crown that no longer has it's trunk. Optionally, you can disable item drop - in case you are mining further away than pickup radius value.
Overall, this is a very good and useful mod, thank you for providing it.

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Wed Oct 03, 2018 16:08
by Hybrid Dog
I've pushed a fix: https://github.com/minetest-mods/item_d ... a929a7f042
Please test if it works.

A small problem is left: When a player makes an item fly to it and then quickly runs away from it, the item flies away, e.g. into sky. After 5 (magnet_time) seconds, the item is collected (or falls down if it can't be collected).
This could be fixed by moving the magnet flight code to the on_step function.

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Wed Oct 03, 2018 22:10
by zasnool
It works good in first-person view, but in third person you can see that the items fly right through the player on a vector. I would've never noticed it if it wasn't for you pointing to that problem. By the way, this happens even when the player stands still, you don't have to run away.

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Thu Oct 04, 2018 09:36
by Hybrid Dog
zasnool wrote:It works good in first-person view, but in third person you can see that the items fly right through the player on a vector. I would've never noticed it if it wasn't for you pointing to that problem. By the way, this happens even when the player stands still, you don't have to run away.
I can't reproduce it in singleplayer mode.
The item doesn't collide with the player and I can't easily change this behaviour. If you set pickup_radius large enough, the item should be detected earlier before reaching the player.
I assume you disabled pickup_particle because it may look gaudy together with magnet mode.

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Wed Jan 02, 2019 21:42
by SpaghettiToastBook
Is it possible that you could make it so that some of the settings work on a per-player basis? This could be used to make auto-pickup and the magnet effect into power-ups.

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Wed Jan 02, 2019 22:50
by texmex
SpaghettiToastBook wrote:Is it possible that you could make it so that some of the settings work on a per-player basis? This could be used to make auto-pickup and the magnet effect into power-ups.
Interesting idea. For example, features can be protected by privileges. But it would be more like punishing non-privileged players by forcing them to first break the node, then having to pick it up one-by-one. But that’s perhaps exactly what you want? >:)

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Thu Jan 03, 2019 04:04
by SpaghettiToastBook
texmex wrote:
SpaghettiToastBook wrote:Is it possible that you could make it so that some of the settings work on a per-player basis? This could be used to make auto-pickup and the magnet effect into power-ups.
Interesting idea. For example, features can be protected by privileges. But it would be more like punishing non-privileged players by forcing them to first break the node, then having to pick it up one-by-one. But that’s perhaps exactly what you want? >:)
Essentially. I'm working on a mod that adds equipment slots, and I wanted to make a piece of equipment that attracts nearby items. I'm currently using this mod just so that you don't have to click on items to pick them up, so this would only be a minor upgrade.

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Thu Jan 03, 2019 08:43
by texmex
Interesting. If I got time I can implement it as an opt-in setting that enable a check for a matching priv. That way default mod behavior isn’t affected. But should it reverse key-triggered pickup action settings? If so I feel the mod would start to get a bit bloated.

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Fri Jan 04, 2019 01:52
by runs
This mod is very cool. I use it.

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Fri Jan 04, 2019 17:54
by Hybrid Dog
texmex wrote:Interesting. If I got time I can implement it as an opt-in setting that enable a check for a matching priv. That way default mod behavior isn’t affected. But should it reverse key-triggered pickup action settings? If so I feel the mod would start to get a bit bloated.
The mod is structured so that when specific settings are disabled, the code is not executed. For example, the code which makes items fly to players is ignored if magnet_mode is disabled: https://github.com/minetest-mods/item_d ... t.lua#L132
This could make player-based settings difficult to implement.
However, functions can be added to disable the behaviour under specific conditions when the setting is enabled.

I think that using a privilege is a workaround for what you try to achieve.
To make it more modular, you can add a function to this mod which can be overridden similar to how minetest.is_protected is overridden.
The player would be a parameter of this function, so you could directly test the equipment slot instead of doing the detour with the privilege.

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Fri Jan 04, 2019 18:51
by texmex
Hybrid Dog wrote:
texmex wrote:Interesting. If I got time I can implement it as an opt-in setting that enable a check for a matching priv. That way default mod behavior isn’t affected. But should it reverse key-triggered pickup action settings? If so I feel the mod would start to get a bit bloated.
The mod is structured so that when specific settings are disabled, the code is not executed. For example, the code which makes items fly to players is ignored if magnet_mode is disabled: https://github.com/minetest-mods/item_d ... t.lua#L132
This could make player-based settings difficult to implement.
However, functions can be added to disable the behaviour under specific conditions when the setting is enabled.

I think that using a privilege is a workaround for what you try to achieve.
To make it more modular, you can add a function to this mod which can be overridden similar to how minetest.is_protected is overridden.
The player would be a parameter of this function, so you could directly test the equipment slot instead of doing the detour with the privilege.
Yes. Sounds like you know what you're doing and I'm merely speculating, which goes to show who's the brains in the item_drop operation =)

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Sat Jan 05, 2019 12:56
by Hybrid Dog
It's actually quite simple.

Code: Select all

local old_can_pickup = item_drop.can_pickup
function item_drop.can_pickup(entity, player)
	-- example code
	if player:get_player_name() == "singleplayer" then
		return false
	end
	return old_can_pickup(entity, player)
end
https://github.com/HybridDog/item_drop/ ... 85b960e0c0
Can I push the commit to master?

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Sat Jan 05, 2019 12:59
by runs
It does not work the magnet thing on 5.0-dev/Android :-(

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Sat Jan 05, 2019 15:12
by texmex
It works just fine on 5.0.0-dev. Android I don’t know about. Are you sure it’s not just set to be key-activated?

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Sat Jan 05, 2019 16:09
by runs
texmex wrote:It works just fine on 5.0.0-dev. Android I don’t know about. Are you sure it’s not just set to be key-activated?
What do you mean by 'key-activate'?

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Sat Jan 05, 2019 17:36
by texmex
item_drop.enable_pickup_key should be set to true by default, and that key should be Use key by default (E on desktops).

Re: [Mod] Item drops, pickups. Rewrite, new features [item_d

Posted: Sat Jan 05, 2019 22:34
by runs
texmex wrote:item_drop.enable_pickup_key should be set to true by default, and that key should be Use key by default (E on desktops).
Oh, I will try that. :-)

Re: [Mod] Item magnet and in-world node drops [item_drop]

Posted: Wed Feb 13, 2019 01:44
by texmex
New feature! It's now possible to disable manual item pickups by mouse. This disables those pesky selection boxes for items, making the item magnet the only way of picking them up. Mouse pickups are still enabled by default, however.

Re: [Mod] Item magnet and in-world node drops [item_drop]

Posted: Sun May 12, 2019 15:49
by Joseph16
For some reason it doesn't drop items if they come from an ore. I can mine stone fine and it works as expected, but if I mine coal it mines it but doesn't go into my inventory, or is dropped on the ground.
Minetest 5.0.1
Just try to mine coal in survival to reproduce

Re: [Mod] Item magnet and in-world node drops [item_drop]

Posted: Thu May 16, 2019 09:37
by Hybrid Dog
Ore drops should work now.
https://github.com/minetest-mods/item_d ... c7b76c9add
Thanks for discovering this bug.

Re: [Mod] Item magnet and in-world node drops [item_drop]

Posted: Sat May 25, 2019 19:47
by FreeGamers
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.

Re: [Mod] Item magnet and in-world node drops [item_drop]

Posted: Sun May 26, 2019 16:53
by texmex
Fix is out on Github. Can you test it?

Re: [Mod] Item magnet and in-world node drops [item_drop]

Posted: Sun May 26, 2019 23:46
by FreeGamers
texmex wrote:Fix is out on Github. Can you test it?
You bet. I'll try it out immediately.

EDIT: So far I haven't seen the bug reoccur in about 2 days of testing.