register_tool uses

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

register_tool uses

by Kilarin » Fri Apr 11, 2014 18:08

Pardon my extreme ignorance, but I've got a very basic modding question.

The wiki says that a pickaxe is good for:
wooden: uses=30
stone: uses=60
steel: uses=180
bronze: uses=270
mese: uses=580
diamond: uses=810

But when I look in minetest\games\minetest_game\mods\default\tools.lua I see:
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:pick_wood", {
    description = "Wooden Pickaxe",
    inventory_image = "default_tool_woodpick.png",
    tool_capabilities = {
        full_punch_interval = 1.2,
        max_drop_level=0,
        groupcaps={
            cracky = {times={[3]=1.60}, uses=10, maxlevel=1},
        },
        damage_groups = {fleshy=2},
    },
})

With
wood: uses=10
stone: uses=20
steel: uses=20
bronze: uses=30
mese: uses=20
diamond: uses=30

Which... confuses me.

I found this: http://c55.me/minetest2/wiki/doku.php?id=roadmap:digging_time_groups

which indicates that there is a maxwear option that could be set, but I don't find it anywhere in the lua files.

So how do I translate (or set) the uses value in tool_capabilities into number of blocks dug?

Thanks,
Last edited by Kilarin on Fri Apr 11, 2014 18:09, edited 1 time in total.
 

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

by PilzAdam » Fri Apr 11, 2014 19:43

The wiki you linked is very old and outdated.

The uses of a tool are multiplied by 3^leveldiff (https://github.com/minetest/minetest/blob/142e2d3b74ad886eed83b0fc9d6cfea100dae10a/doc/lua_api.txt#L736).
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

by Kilarin » Fri Apr 11, 2014 20:17

PilzAdam wrote:The uses of a tool are multiplied by 3^leveldiff

Thank you for the link!
So, am I understanding correctly that this means a pickaxe is used up more quickly when digging "harder" nodes? So that your pickaxe would wear out a lot faster digging obsidian than digging stone?
 

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

by PilzAdam » Fri Apr 11, 2014 20:18

Kilarin wrote:
PilzAdam wrote:The uses of a tool are multiplied by 3^leveldiff

Thank you for the link!
So, am I understanding correctly that this means a pickaxe is used up more quickly when digging "harder" nodes? So that your pickaxe would wear out a lot faster digging obsidian than digging stone?

Yes.
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

by stu » Fri Apr 11, 2014 20:21

Kilarin wrote:
PilzAdam wrote:The uses of a tool are multiplied by 3^leveldiff

Thank you for the link!
So, am I understanding correctly that this means a pickaxe is used up more quickly when digging "harder" nodes? So that your pickaxe would wear out a lot faster digging obsidian than digging stone?


If you want to override this default behaviour then you can add item wear explicitly in the on_use callback.
Last edited by stu on Fri Apr 11, 2014 20:22, edited 1 time in total.
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

by Kilarin » Fri Apr 11, 2014 20:50

stu wrote:If you want to override this default behaviour then you can add item wear explicitly in the on_use callback.

Not my intention, but nice to know, thanks!
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 6 guests

cron