Durability of a tool / Tool Abilities

tbillon2003
New member
 
Posts: 5
Joined: Tue Apr 02, 2013 15:53

Durability of a tool / Tool Abilities

by tbillon2003 » Tue Apr 02, 2013 20:21

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?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Wed Apr 03, 2013 10:35

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.
 

tbillion
Member
 
Posts: 189
Joined: Wed Apr 03, 2013 16:07

by tbillion » Wed Apr 03, 2013 16:11

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!
"And then there was one"

My Minetest Server:
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
8 Core Intel(R) Xeon(R) CPU X5450 @ 3.00GHz
Physical RAM : 62.49 GiB
Graphics: [AMD/ATI] Cayman PRO [Radeon HD 6950]
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 7 guests

cron