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

zasnool
Member
 
Posts: 14
Joined: Wed Oct 03, 2018 03:24

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

by zasnool » Wed Oct 03, 2018 08:39

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.
 

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

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

by texmex » Wed Oct 03, 2018 09:51

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!
 

zasnool
Member
 
Posts: 14
Joined: Wed Oct 03, 2018 03:24

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

by zasnool » Wed Oct 03, 2018 12:38

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.
 

User avatar
Hybrid Dog
Member
 
Posts: 2718
Joined: Thu Nov 01, 2012 12:46

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

by Hybrid Dog » Wed Oct 03, 2018 16:08

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.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

zasnool
Member
 
Posts: 14
Joined: Wed Oct 03, 2018 03:24

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

by zasnool » Wed Oct 03, 2018 22:10

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.
 

User avatar
Hybrid Dog
Member
 
Posts: 2718
Joined: Thu Nov 01, 2012 12:46

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

by Hybrid Dog » Thu Oct 04, 2018 09:36

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.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

User avatar
SpaghettiToastBook
Member
 
Posts: 52
Joined: Sun Feb 22, 2015 21:11
Location: The Milky Way
In-game: STB

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

by SpaghettiToastBook » Wed Jan 02, 2019 21:42

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.
 

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

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

by texmex » Wed Jan 02, 2019 22:50

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? >:)
 

User avatar
SpaghettiToastBook
Member
 
Posts: 52
Joined: Sun Feb 22, 2015 21:11
Location: The Milky Way
In-game: STB

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

by SpaghettiToastBook » Thu Jan 03, 2019 04:04

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.
 

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

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

by texmex » Thu Jan 03, 2019 08:43

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.
 

User avatar
runs
Member
 
Posts: 480
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy
 

User avatar
Hybrid Dog
Member
 
Posts: 2718
Joined: Thu Nov 01, 2012 12:46

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

by Hybrid Dog » Fri Jan 04, 2019 17:54

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.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

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

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

by texmex » Fri Jan 04, 2019 18:51

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 =)
 

User avatar
Hybrid Dog
Member
 
Posts: 2718
Joined: Thu Nov 01, 2012 12:46

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

by Hybrid Dog » Sat Jan 05, 2019 12:56

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?

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

User avatar
runs
Member
 
Posts: 480
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy
 

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

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

by texmex » Sat Jan 05, 2019 15:12

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?
 

User avatar
runs
Member
 
Posts: 480
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

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

by runs » Sat Jan 05, 2019 16:09

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'?
 

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

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

by texmex » Sat Jan 05, 2019 17:36

item_drop.enable_pickup_key should be set to true by default, and that key should be Use key by default (E on desktops).
 

User avatar
runs
Member
 
Posts: 480
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

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

by runs » Sat Jan 05, 2019 22:34

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. :-)
 

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

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

by texmex » Wed Feb 13, 2019 01:44

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.
 

User avatar
Joseph16
Member
 
Posts: 306
Joined: Tue Dec 06, 2016 05:35
In-game: Joseph16

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

by Joseph16 » Sun May 12, 2019 15:49

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
Testin' mines since 1989
 

User avatar
Hybrid Dog
Member
 
Posts: 2718
Joined: Thu Nov 01, 2012 12:46

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

by Hybrid Dog » Thu May 16, 2019 09:37

Ore drops should work now.
https://github.com/minetest-mods/item_d ... c7b76c9add
Thanks for discovering this bug.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

User avatar
jeremyweston
Member
 
Posts: 127
Joined: Sat May 25, 2019 00:15
GitHub: jeremyweston

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

by jeremyweston » Sat May 25, 2019 19:47

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: 1400
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

User avatar
jeremyweston
Member
 
Posts: 127
Joined: Sat May 25, 2019 00:15
GitHub: jeremyweston

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

by jeremyweston » Sun May 26, 2019 23:46

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.
 

PreviousNext

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 9 guests