Node drops - me dumb - plz help

KzoneDD
Member
 
Posts: 52
Joined: Wed Sep 17, 2014 09:29

Node drops - me dumb - plz help

by KzoneDD » Wed Mar 02, 2016 14:25

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!!!
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Node drops - me dumb - plz help

by kaeza » Wed Mar 02, 2016 14:38

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.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

KzoneDD
Member
 
Posts: 52
Joined: Wed Sep 17, 2014 09:29

Re: Node drops - me dumb - plz help

by KzoneDD » Wed Mar 02, 2016 15:05

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

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Node drops - me dumb - plz help

by Don » Wed Mar 02, 2016 15:53

You should be able to get_node().name and then use that to do item_drop.
http://dev.minetest.net/minetest.item_drop

Edit - you could also use spawn item http://dev.minetest.net/minetest.spawn_item
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

KzoneDD
Member
 
Posts: 52
Joined: Wed Sep 17, 2014 09:29

Re: Node drops - me dumb - plz help

by KzoneDD » Wed Mar 02, 2016 22:00

Ah, that was... simpler than expected... Thanks. :)

Now, what to do with a chest full of 'air (you hacker you)'... ;-)
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron