Page 1 of 1

Modifying defaults

PostPosted: Sun May 01, 2016 11:30
by burli
I want to modify the defaults. But I don't want to modify the original files.

I know that I can use override_item(). My question is: how can I use a loop to modify multiple item? For example I want to remove oddly_breakable_by_hand from all trees and from all wooden items.


Then I want to remove regeneration. I intstalled the hunger mod, but the player should use potions or specific plants to heal. No automatic regeneration and no food regeneration

And I want to change the crafting area to 2x2. How can I do that?

Re: Modifying defaults

PostPosted: Sun May 01, 2016 12:23
by qwertymine3
Those are 3 very different questions...

1. I think that the easiest way would be to have a "for in ipairs" loop, over a table with the names of all wooden items in it.
You could use string matching and loop over all registered items looking for wood 'keywords' instead, such as "plank" or "wood", but IDK how performant that would be.

2. This may or may not be possible. Look to see if there are settings for the hunger mod which you can modify to achieve this, if not you will have to edit the mod

3. IDK how to do this, I assume you have to edit the crafting form-spec only show a 2x2 area for crafting.
BlockMen made a mod which does this however (with some other inventory changes), under the WTFPL, so you could look at how that mod does it.
Crafting: https://forum.minetest.net/viewtopic.php?id=5641

Re: Modifying defaults

PostPosted: Mon May 02, 2016 07:18
by burli
I think I will loop over a table. Search for keywords might be dangerous

Re: Modifying defaults

PostPosted: Mon May 02, 2016 09:21
by Naj
You can loop through minetest.registered_nodes and then test if node belongs to "wood" or "tree" groups.

Re: Modifying defaults

PostPosted: Mon May 02, 2016 09:29
by burli
Naj wrote:You can loop through minetest.registered_nodes and then test if node belongs to "wood" or "tree" groups.


I will try it.

Re: Modifying defaults

PostPosted: Tue May 03, 2016 13:57
by burli
Naj wrote:You can loop through minetest.registered_nodes and then test if node belongs to "wood" or "tree" groups.


Is it possible to filter with a regex expression? If yes, how does it work?

Edit: forget it. Too dangerous. If I search for "tree" I also find things like dryplants:wetreed