Page 1 of 1

[Solved] How do you check when an item is dropped?

PostPosted: Wed Apr 11, 2012 21:04
by lkjoel
I'm making a mod with jordan4ibanez, and I need help to check when an item is dropped. This means dropped and on the ground, not dropping. This is crucial.
Any ideas on how to implement this?

PostPosted: Wed Apr 11, 2012 21:07
by Jeija
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
        if minetest.registered_nodes[nn].walkable then
            if self.physical_state then
                self.object:setvelocity({x=0,y=0,z=0})
                self.object:setacceleration({x=0, y=0, z=0})
                self.physical_state = false
                self.object:set_properties({
                    physical = false
                })
            end
        else

This is in builtin/item_entity.lua
I suppose everything in this if clause is executed if an item is on the ground. What do you want to do?
If you want to make the item kinda "fly" to you when walking next to it, I already tried it. I can give you some advice.

PostPosted: Wed Apr 11, 2012 21:14
by lkjoel
yeah, like in minecraft. We have an outer circle that makes the item fly to you, and an inner circle that adds it to your inventory.

PostPosted: Wed Apr 11, 2012 21:42
by lkjoel
thanks a lot! It works