Page 1 of 1

How can I remove a tool?

PostPosted: Fri May 06, 2016 16:54
by burli
Ok, another question. How can I remove a registered tool and its recipe?

Re: How can I remove a tool?

PostPosted: Fri May 06, 2016 17:38
by vitalie
AFAIK, you can't.

See issue #2319

Re: How can I remove a tool?

PostPosted: Fri May 06, 2016 17:54
by burli
I was afraid of that. Thx

Re: How can I remove a tool?

PostPosted: Fri May 06, 2016 17:59
by vitalie
Well, for items you can set an AMB to replace everything in sight with air, and for crafts you can redefine them to something else.

Re: How can I remove a tool?

PostPosted: Fri May 06, 2016 18:05
by burli
There should be some solution, but it doesn't work yet. Pulled the latest dev right now and compiled it

https://github.com/minetest/minetest/pull/4034

Re: How can I remove a tool?

PostPosted: Sat May 07, 2016 03:21
by maikerumine
Simple!

Edit the tools.lua with notepad by adding:
--[[
In front of the code you want to remove
And
]]
After.

This is commenting out code so minetest wont register the tool.

Re: How can I remove a tool?

PostPosted: Sat May 07, 2016 05:01
by burli
maikerumine wrote:Edit the tools.lua with notepad by adding:

I don't want to edit the files from minetest game. If you play other games they are also effected and if you make an update the tool is back. That's the wrong way

Re: How can I remove a tool?

PostPosted: Sat May 07, 2016 06:56
by xeranas
Not sure if this best way but you can try:
1. Create new mod (if you haven't yet) for overriding stuff
2. Include mods into depends.txt who you gonna modify (e.g. default)
3. Override desired tool by assigning it to nil for e.g. pick_wood
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.registered_items["default:pick_wood"] = nil

4. Hope that game still works down the road.

[updated]
vitalie wrote:AFAIK, you can't.
See issue #2319

Right. With way which I suggested you will only hide from creative mod items menu (tool still be craftable).

Re: How can I remove a tool?

PostPosted: Sat May 07, 2016 07:55
by burli
xeranas wrote:Right. With way which I suggested you will only hide from creative mod items menu (tool still be craftable).

Currently the only "official" way to remove a tool is to redefine the recipe with an empty output.

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_craft({
   output = '',
   recipe = {
      {'group:wood', 'group:wood', 'group:wood'},
      {'', 'group:stick', ''},
      {'', 'group:stick', ''},
   }
})


If you want to hide it in creative inventory you can use

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.override_item("default:pick_wood", {
            groups = {not_in_creative_inventory = 1},
        })


That's all you can do right now if you don't want to delete it in tools.lua and crafting.lua, which in not recommended

Re: How can I remove a tool?

PostPosted: Sat May 07, 2016 22:10
by blert2112
Try 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_diamond", {})

It should not show up anywhere nor will it be craftable.