Unexpected tool behavior on 'crumbly' nodes

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

Unexpected tool behavior on 'crumbly' nodes

by Terumoc » Sat Dec 30, 2017 01:59

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: 2113
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Unexpected tool behavior on 'crumbly' nodes

by sofar » Sat Dec 30, 2017 04:34

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: 57
Joined: Thu Dec 28, 2017 20:00
GitHub: Terumoc
In-game: Terumoc

Re: Unexpected tool behavior on 'crumbly' nodes

by Terumoc » Sat Dec 30, 2017 14:55

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
 


Return to Problems



Who is online

Users browsing this forum: No registered users and 2 guests