Node drops - me dumb - plz help

Posted:
Wed Mar 02, 2016 14:25
by KzoneDD
Hi all,
If I have the node position stored in local e,
all I want to do is destroy the node and drop on the ground what should drop after dig. Not in any inventory, not attributed to a player, just a drop.
I can't get my head around how the methods work, I've peeked in the tnt mod, among others and I'm simply running up against the limits of my cognitive abilities...
plz, how?
Correct answer will be honored in my hall of fame and get a mention if this results in a mod that reaches wip status. ;-)
Thx!!!
Re: Node drops - me dumb - plz help

Posted:
Wed Mar 02, 2016 14:38
by kaeza
What have you tried? What didn't work? And most importantly, what are you trying to implement?
Probably the most straightforward example is how PilzAdam's `item_drop` mod
handles this.
BTW, if you were thinking about implementing that, it is just wasted effort. Better to contribute to an already existing solution than reinventing the wheel.
Re: Node drops - me dumb - plz help

Posted:
Wed Mar 02, 2016 15:05
by KzoneDD
I tried to replicate a tnt effect. I did look at the item_drop mod too.
My code became a mess, I threw a lot away to try new things.
In essence, the code loops through a set radius to remove nodes. At the moment it makes neat tunnel-like holes but I want to implement some randomness and a system that takes into account dig types. Not done yet, but I'm fairly confident.
In essence, I have minetest.remove_node(f), where f is a node position that changes with each iteration.
What I'd like to do is:
while (iteration stuff) do
minetest.remove_node(f)
minetest-drop-the-drop(f)
end
All else is either handled elsewhere or a next step and not getting ahead of myself. :)
Re: Node drops - me dumb - plz help

Posted:
Wed Mar 02, 2016 15:53
by Don
You should be able to get_node().name and then use that to do item_drop.
http://dev.minetest.net/minetest.item_dropEdit - you could also use spawn item
http://dev.minetest.net/minetest.spawn_item
Re: Node drops - me dumb - plz help

Posted:
Wed Mar 02, 2016 22:00
by KzoneDD
Ah, that was... simpler than expected... Thanks. :)
Now, what to do with a chest full of 'air (you hacker you)'... ;-)