Page 1 of 1

add_tool: for adding tools!

PostPosted: Sun Dec 11, 2011 05:46
by MarkTraceur
Are you making a new mineral/ore/gem/thing that shouldn't be physically possible to make into a tool but somehow need to be added to minetest anyway?

Are you going to make a tool out of that new thing?

Try the add_tool mod!

Latest at https://gitorious.org/marktraceur-minetest-mods/add_tool
See below for current release

Usage example:

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
-- Adds a gold set of tools (using the moreores mod) where the shovel is more durable and the axe is slower than the rest.
register_tool_type("moreores", "gold", 'craft "moreores:gold_ingot"', 0.9, 220, {shovel_durability = 40, axe_speed = 1})


Releases:

0.1 -- initial
Download at https://gitorious.org/marktraceur-minetest-mods/add_tool/archive-tarball/0.1
Last commit was https://gitorious.org/marktraceur-minetest-mods/add_tool/commit/0f984e86f2b36d1af721a037537823ba952da53d

PostPosted: Sun Dec 11, 2011 06:04
by darket
cool )

PostPosted: Sun Dec 11, 2011 09:01
by ironzorg
Why make it a mod and not simply release the code, since it's just a function ?

PostPosted: Sun Dec 11, 2011 09:20
by MarkTraceur
ironzorg wrote:Why make it a mod and not simply release the code, since it's just a function ?


Well, since it relies on minetest-specific code, I figured it would be best to use the minetest dependency management structure, instead of simply calling it a Lua function. Plus, I greatly prefer organizing all of my minetest-related code on gitorious, it's a far simpler way to do things.

Other reason: End users know how to unpack mods, they don't know how to put a function in the right place (most of the time).

PostPosted: Sun Dec 11, 2011 09:46
by sfan5
Cool Idea!

PostPosted: Mon Dec 26, 2011 17:36
by IPushButton2653
I have no clue how this thing works :/

PostPosted: Thu Dec 29, 2011 19:14
by IPushButton2653
Could someone please explain how this works??? I'm trying to make a few tool/weapon mods, but I can't seem to find a way how...

PostPosted: Fri Dec 30, 2011 02:37
by MarkTraceur
Yes.

First, put add_tool in your mod's depends.txt, so you can't run your mod without mine. This will ensure that users install mine before yours (suggest that you link to mine in your documentation).

Second, call register_tool_type with the specified options (see init.lua for more).

PostPosted: Fri Dec 30, 2011 04:43
by IPushButton2653
I understand now, thanks

PostPosted: Mon Jan 23, 2012 16:22
by kahrl
Updated it for 0.4-dev-20120122-1: http://paste.pocoo.org/show/539320/

There should be a way to set the description of the new tools, though. A new parameter?