add_tool: for adding tools!

MarkTraceur
Member
 
Posts: 103
Joined: Sat Dec 03, 2011 05:41

add_tool: for adding tools!

by MarkTraceur » Sun Dec 11, 2011 05:46

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
Mods: https://gitorious.org/marktraceur-minetest-mods
IRC: marktraceur on freenode
 

User avatar
darket
Member
 
Posts: 34
Joined: Sun Nov 27, 2011 10:35

by darket » Sun Dec 11, 2011 06:04

cool )
 

ironzorg
Member
 
Posts: 46
Joined: Tue Aug 23, 2011 06:34

by ironzorg » Sun Dec 11, 2011 09:01

Why make it a mod and not simply release the code, since it's just a function ?
 

MarkTraceur
Member
 
Posts: 103
Joined: Sat Dec 03, 2011 05:41

by MarkTraceur » Sun Dec 11, 2011 09:20

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).
Mods: https://gitorious.org/marktraceur-minetest-mods
IRC: marktraceur on freenode
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Dec 11, 2011 09:46

Cool Idea!
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
IPushButton2653
Member
 
Posts: 666
Joined: Wed Nov 16, 2011 22:47

by IPushButton2653 » Mon Dec 26, 2011 17:36

I have no clue how this thing works :/
 

User avatar
IPushButton2653
Member
 
Posts: 666
Joined: Wed Nov 16, 2011 22:47

by IPushButton2653 » Thu Dec 29, 2011 19:14

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...
 

MarkTraceur
Member
 
Posts: 103
Joined: Sat Dec 03, 2011 05:41

by MarkTraceur » Fri Dec 30, 2011 02:37

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).
Mods: https://gitorious.org/marktraceur-minetest-mods
IRC: marktraceur on freenode
 

User avatar
IPushButton2653
Member
 
Posts: 666
Joined: Wed Nov 16, 2011 22:47

by IPushButton2653 » Fri Dec 30, 2011 04:43

I understand now, thanks
 

kahrl
Member
 
Posts: 236
Joined: Fri Sep 02, 2011 07:51

by kahrl » Mon Jan 23, 2012 16:22

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?
Last edited by kahrl on Mon Jan 23, 2012 16:23, edited 1 time in total.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 6 guests

cron