Page 1 of 1

Understanding the numbers. Groupcaps, uses, maxlevels, max_drop_level

PostPosted: Tue Aug 06, 2013 14:26
by BadWolf
I had a friend who's playing the game ask me yesterday if the mithril pickaxe was better than the mese pickaxe. Since I'm dabbling in the code to make mods. I thought I'd look at the code directly. I think I understand the "Time" numbers correctly. If the node includes group
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
oddly_breakable_by_hand=3
. and the wielded tool
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
oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40}, uses=0, maxlevel=3}
then the node will take 1.4 to be destroyed. Here from this code I can ascertain that uses=0 must mean infinite uses because the object that I took it from is the hand. But I do not understand how say the mese pickaxe has a uses level of 20. when clearly it can be used more times than 20. I theorized that different nodes can use it up at different rates, but looking at the node code I don't see any corresponding numbers. maxlevel and max_drop_level, I could guess about what they do, but they are mystery, for example the only difference aside from time value between the mese and steel pickaxe is maxlevel -1, not uses which equal 20 in both cases. Could anyone explain exactly what these numbers do? and how they might correspond with numbers in the nodes?

thanks

PostPosted: Tue Aug 06, 2013 15:08
by PilzAdam
It depends on the level. The nodes have a "level" field in the groups and the tools have a "maxlevel".
Tools can only dig nodes with level <= maxlevel.
Tools with higher level take longer to dig and wear out the tools faster (the use count is multiplied by 3^leveldiff)

PostPosted: Tue Aug 06, 2013 16:18
by cHyper
are there any wiki-pages with these informations. not everybody can read the LUA or C code to find out how tools are working with the different ways of usement. comments of source-codes helps only programmers but dont show you the complexity of the objects working together.

Documentation is very important for normal beginners.
the news-section of the forum is a first very important thing for everybody who want to understand the changes of a complex game as minetest is.


sorry for the bad english.

PostPosted: Tue Aug 06, 2013 16:36
by PilzAdam
Its documented in the main resource for modders: https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L671

PostPosted: Tue Aug 06, 2013 17:42
by BadWolf
Thanks PilzAdam,

That document is an awesome resource! I hadn't found that before.
One question that isn't quite explained is this apparent contradiction:

the definition of the steel_axe includes this:
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
groupcaps={
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=2},
},


and the stone block is this:
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
groups = {cracky=3, stone=1},


correct me if I'm wrong, because I know that the steel pick can break stone, but the cracky level of stone is 3, the max level of the steel pick for cracky is 2, and I don't see a definition for the steel pick to work with the stone group.

PostPosted: Tue Aug 06, 2013 19:25
by PilzAdam
BadWolf wrote:Thanks PilzAdam,

That document is an awesome resource! I hadn't found that before.
One question that isn't quite explained is this apparent contradiction:

the definition of the steel_axe includes this:
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
groupcaps={
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=2},
},


and the stone block is this:
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
groups = {cracky=3, stone=1},


correct me if I'm wrong, because I know that the steel pick can break stone, but the cracky level of stone is 3, the max level of the steel pick for cracky is 2, and I don't see a definition for the steel pick to work with the stone group.

The rating of the "cracky" group just says which digging time to take, the level is a different field (0 for stone, since its not set).
E.g. the steelblock has level 2:
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
groups = {cracky=1,level=2},

PostPosted: Tue Aug 06, 2013 20:28
by BadWolf
Thanks!