Page 1 of 1

Is there a way to...?

PostPosted: Sat Oct 03, 2015 03:13
by blert2112
Is there a way to remove a tool from the game without having to modify the mod code?
Example: Say I want to remove diamond tools and swords, to do away with them completely. I still want to continue to use 'default', of course. Can the game be told to remove or forget these items or is the only possible way by commenting them all out in the mod?

Re: Is there a way to...?

PostPosted: Sat Oct 03, 2015 06:57
by Napiophelios
maybe you could try to create an alias file/mod?

Re: Is there a way to...?

PostPosted: Sat Oct 03, 2015 07:16
by Krock
Create a new mod with the dependency on default.
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
local to_delete = {
   "pick", "shovel", "axe", "sword"
}

for i,v in ipairs(to_delete) do
   minetest.registered_tools["default:"..v.."_diamond"] = nil
end

Re: Is there a way to...?

PostPosted: Sat Oct 03, 2015 16:47
by blert2112
Krock wrote:Create a new mod with the dependency on default.
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
local to_delete = {
   "pick", "shovel", "axe", "sword"
}

for i,v in ipairs(to_delete) do
   minetest.registered_tools["default:"..v.."_diamond"] = nil
end

Unfortunately, this does not work.
It removes it from the that global table but it is still available in the game.

This works, sort of...
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:sword_diamond"] = nil

If it is already in the game you can still use it but it no longer in the inventory. The crafting recipe will still produce one.

This seems to work completely...
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", {})

Will continue testing as I work on this weapons mod.
Thanks Krock. You pointed me in the proper direction of what I should have been looking for.

Re: Is there a way to...?

PostPosted: Sat Oct 03, 2015 18:16
by Don
What if you override the craft?

Re: Is there a way to...?

PostPosted: Tue Oct 06, 2015 14:13
by LazerRay
Modifying the crafting of an object can work, making it uncraftable will disable that item in survival mode, or you can just comment out that particular crafting recipe to disable the object. (Note, the item you disabled the crafting for will still be available in the creative menu and through the "Give" command)

I have done the reverse, I added in extra crafting recipes for objects that needed them.

Re: Is there a way to...?

PostPosted: Sat Nov 14, 2015 01:57
by wilkgr76
As said before, override the crafting recipe. Also, redefine it (define_tool ":default:sword_diamond) and add "not_in_creative_inventory =1" to groups.