Unexpected tool behavior on 'crumbly' nodes

Post Reply
Terumoc
Member
Posts: 58
Joined: Thu Dec 28, 2017 20:00
GitHub: Terumoc
In-game: Terumoc

Unexpected tool behavior on 'crumbly' nodes

by Terumoc » Post

Hello!

I'm working on a mod that provides information about the node you're clicking, and that includes the fitness of your current tool in mining it it.

So far I think I've done a pretty good job in figuring out the default minetest digging system, where:
1. The current tool must have a group that matches the node's
2. The current tool must have a dig speed for the nodes "hardness" (ex: NodeDef->groups.cracky=3 needs a ToolDef->groupcaps.times.cracky[3] to exist for that tool to work)
3. The node cannot have a level group higher than the tool's matching maxlevel (ergo, NodeDef->groups.level must be <= ToolDef->groupcaps.times.cracky.maxlevel)

However, I've realized that dirt nodes of all types, gravel, and sand (so nearly every other crumbly node I've tested) can be dug with tools that do not have a crumbly group such as picks, axes, and swords. Because of this, my mod isn't reporting those tools correctly

Can anyone with more experience or knowledge of minetest's internals help me out in figuring out why crumbly-group nodes can be dug by tools without a crumbly group set? Is it just some sort of default override behavior to allow anything to mine crumbly nodes? I'd really like to know the reason this happens so I can account for it accurately in my mod.

Oh and the mod is on github at https://github.com/Terumoc/teruview if you want to see it.

Thanks a lot!
Maker of Terumetal and Teruview mods at https://github.com/Terumoc

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Unexpected tool behavior on 'crumbly' nodes

by sofar » Post

https://wiki.minetest.net/Hand

Even while wielding a tool that is incapable of digging a specific node type, you are also in the possession of the "hand" item. In most games, the hand is capable of removing a bunch of nodes that e.g. a pickaxe isn't capable of. If the pickaxe fails to dig a node, the hand tool capabilities will be used.

https://github.com/minetest/minetest_ga ... it.lua#L28

Terumoc
Member
Posts: 58
Joined: Thu Dec 28, 2017 20:00
GitHub: Terumoc
In-game: Terumoc

Re: Unexpected tool behavior on 'crumbly' nodes

by Terumoc » Post

Aha! That definitely explains it. It's a good idea too, I like that it's implemented that way.

Thanks a ton for the explanation!
Maker of Terumetal and Teruview mods at https://github.com/Terumoc

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests