How can I remove a tool?

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

How can I remove a tool?

by burli » Fri May 06, 2016 16:54

Ok, another question. How can I remove a registered tool and its recipe?
 

vitalie
Member
 
Posts: 66
Joined: Wed Feb 24, 2016 07:38
GitHub: ciubotaru

Re: How can I remove a tool?

by vitalie » Fri May 06, 2016 17:38

AFAIK, you can't.

See issue #2319
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I remove a tool?

by burli » Fri May 06, 2016 17:54

I was afraid of that. Thx
 

vitalie
Member
 
Posts: 66
Joined: Wed Feb 24, 2016 07:38
GitHub: ciubotaru

Re: How can I remove a tool?

by vitalie » Fri May 06, 2016 17:59

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.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I remove a tool?

by burli » Fri May 06, 2016 18:05

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
 

User avatar
maikerumine
Member
 
Posts: 946
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: How can I remove a tool?

by maikerumine » Sat May 07, 2016 03:21

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.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I remove a tool?

by burli » Sat May 07, 2016 05:01

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
 

User avatar
xeranas
Member
 
Posts: 99
Joined: Fri Feb 05, 2016 11:06
GitHub: xeranas

Re: How can I remove a tool?

by xeranas » Sat May 07, 2016 06:56

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

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I remove a tool?

by burli » Sat May 07, 2016 07:55

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
 

blert2112
Member
 
Posts: 244
Joined: Sat Apr 25, 2015 04:05
GitHub: blert2112

Re: How can I remove a tool?

by blert2112 » Sat May 07, 2016 22:10

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.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

cron