Is there a way to...?

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

Is there a way to...?

by blert2112 » Sat Oct 03, 2015 03:13

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?
 

User avatar
Napiophelios
Member
 
Posts: 752
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: Is there a way to...?

by Napiophelios » Sat Oct 03, 2015 06:57

maybe you could try to create an alias file/mod?
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Is there a way to...?

by Krock » Sat Oct 03, 2015 07:16

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
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

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

Re: Is there a way to...?

by blert2112 » Sat Oct 03, 2015 16:47

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.
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Is there a way to...?

by Don » Sat Oct 03, 2015 18:16

What if you override the craft?
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
LazerRay
Member
 
Posts: 146
Joined: Sun Jul 27, 2014 01:32
GitHub: LazerRay

Re: Is there a way to...?

by LazerRay » Tue Oct 06, 2015 14:13

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.
 

User avatar
wilkgr76
Member
 
Posts: 680
Joined: Wed Feb 18, 2015 02:44
GitHub: wilkgr76
IRC: wilkgr
In-game: wilkgr

Re: Is there a way to...?

by wilkgr76 » Sat Nov 14, 2015 01:57

As said before, override the crafting recipe. Also, redefine it (define_tool ":default:sword_diamond) and add "not_in_creative_inventory =1" to groups.
I do not care.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron