Page 1 of 1

Durability of a tool / Tool Abilities

PostPosted: Tue Apr 02, 2013 20:21
by tbillon2003
how do i make sense of 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
minetest.register_tool("default:sword_wood", {
    description = "Wooden Sword",
    inventory_image = "default_tool_woodsword.png",
    tool_capabilities = {
        full_punch_interval = 1,
        max_drop_level=0,
        groupcaps={
            snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
        },
        damage_groups = {fleshy=2},
    }
})


also ive seen groups snappy fleshy etc, if i wanted to make a range of tools that had different abilities how do i make sense of this in comparison to tohers i have tried experimentation but it is kind of frustrating looking for some pointers?

PostPosted: Wed Apr 03, 2013 10:35
by PilzAdam
I would suggest to read lua-api.txt (as Hybrid Dog linked). It explains pretty good how the group system works.

The basic idea is that each nodes defines one or more groups (e.g. dirt is crumbly) with a rating (dirt has 3). A lower rating means the node is tougher to break (e.g. gravel has crumbly=2 -> longer digging time).
Tools define digging times for the different groups and ratings. For example the steel shovel digs crumbly 3 in 0.4 and crumbly 2 in 0.9 seconds.
For a list of common groups see https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L532

Then there is also the level parameter. A node can define a level, a higher level means longer digging time and less uses of the tool. So a node with cracky=2 and level=0 can be dug faster than a cracky=2 with level=3 node. The tools doesnt need to define anything for this longer digging time.
Tools define a maxlevel, so they can only dig nodes up to a certain level.

You can understand it easier if you read lua-api.txt and look at the default mod and the groups of nodes and tools there.

PostPosted: Wed Apr 03, 2013 16:11
by tbillion
Thank you, i had read that the doc api.txt had been moved but couldnt find it and i am not on the net unless im at the library. But thank you very much!