Modifying defaults

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

Modifying defaults

by burli » Sun May 01, 2016 11:30

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?
 

User avatar
qwertymine3
Member
 
Posts: 194
Joined: Wed Jun 03, 2015 14:33
GitHub: Qwertymine
In-game: qwertymine3

Re: Modifying defaults

by qwertymine3 » Sun May 01, 2016 12:23

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
Avatar by :devnko-ennekappao:
 

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

Re: Modifying defaults

by burli » Mon May 02, 2016 07:18

I think I will loop over a table. Search for keywords might be dangerous
 

User avatar
Naj
Member
 
Posts: 170
Joined: Sat Sep 19, 2015 21:14
GitHub: pyrollo
In-game: naj

Re: Modifying defaults

by Naj » Mon May 02, 2016 09:21

You can loop through minetest.registered_nodes and then test if node belongs to "wood" or "tree" groups.
 

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

Re: Modifying defaults

by burli » Mon May 02, 2016 09:29

Naj wrote:You can loop through minetest.registered_nodes and then test if node belongs to "wood" or "tree" groups.


I will try it.
 

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

Re: Modifying defaults

by burli » Tue May 03, 2016 13:57

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
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron