I want to modify a tool but I can't

User avatar
yawin
Member
 
Posts: 18
Joined: Fri Dec 30, 2016 17:09
In-game: Yawin

I want to modify a tool but I can't

by yawin » Thu Mar 02, 2017 16:37

Hi!

In the mod that i'm making want to create this effect: when the player digs a node with a tool, that tool loses the hability to drop during X seconds. You can continue digging with this tool, but it do not drop never.

The first idea was to create a minetest.register_on_dig_node, check the metadata of the tool, and if the effect is in the metadata change the drop of the node. But it not works.

How do you thing I can do?
dynamic_cast<Signature*>(me→signature)
 

User avatar
qwertymine3
Member
 
Posts: 194
Joined: Wed Jun 03, 2015 14:33
GitHub: Qwertymine
In-game: qwertymine3

Re: I want to modify a tool but I can't

by qwertymine3 » Thu Mar 02, 2017 18:08

Quick reply - you may want to look at:
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
* `minetest.handle_node_drops(pos, drops, digger)`
    * `drops`: list of itemstrings
    * Handles drops from nodes after digging: Default action is to put them into
      digger's inventory
    * Can be overridden to get different functionality (e.g. dropping items on
      ground)

https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L2474
Avatar by :devnko-ennekappao:
 

User avatar
yawin
Member
 
Posts: 18
Joined: Fri Dec 30, 2016 17:09
In-game: Yawin

Re: I want to modify a tool but I can't

by yawin » Sat Mar 04, 2017 12:12

Thanks! I'll see if I can use it successfully.
dynamic_cast<Signature*>(me→signature)
 


Return to Modding Discussion

Who is online

Users browsing this forum: Google [Bot] and 6 guests

cron