before.txt in mods and *#

Post Reply
User avatar
rubenwardy
Moderator
Posts: 6107
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

before.txt in mods and *#

by rubenwardy » Post

Before.txt

I am not sure how easy this is to code into the engine, but mods could have before.txt in their mod folder, which acts like depends.txt, but makes that mod load before the selected mods.

Wildcards

Also, it could be good to add *# wildcard support for example:

Code: Select all

food*?
Summary
These are not that important additions, as most mods will not use them.

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

Ehm, mods in depends.txt are loaded before the mod. You can also use "?" to not depend on the mod, but just load them first.

User avatar
jojoa1997
Member
Posts: 2890
Joined: Thu Dec 13, 2012 05:11
Location: Earth

by jojoa1997 » Post

PilzAdam wrote:Ehm, mods in depends.txt are loaded before the mod. You can also use "?" to not depend on the mod, but just load them first.
I think he means haveing the mod load before others in the file. In mod 1 you have it say default in before.txt and mod 1 will load before default. But i dont think it could work because what if mod 2 befores mod 1 but depends on mod 3. and mod 3 depends on 1 but befores 2. Then none of them can load.
Coding;
1X coding
3X debugging
12X tweaking to be just right

User avatar
rubenwardy
Moderator
Posts: 6107
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

by rubenwardy » Post

Mod 2 has before.txt = "Mod 1?"

Load Order:
Mod 2
Mod 1

User avatar
jojoa1997
Member
Posts: 2890
Joined: Thu Dec 13, 2012 05:11
Location: Earth

by jojoa1997 » Post

rubenwardy wrote:Mod 2 has before.txt = "Mod 1?"

Load Order:
Mod 2
Mod 1
ok that is fine but what if mod 3 befores 2 but depends on 1
Coding;
1X coding
3X debugging
12X tweaking to be just right

User avatar
rubenwardy
Moderator
Posts: 6107
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

by rubenwardy » Post

jojoa1997 wrote:
rubenwardy wrote:Mod 2 has before.txt = "Mod 1?"

Load Order:
Mod 2
Mod 1
ok that is fine but what if mod 3 befores 2 but depends on 1
The it is dealt in the same way as 1 depends on 2, and 2 depends on 1.

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

What would be the benefit if this?

User avatar
jojoa1997
Member
Posts: 2890
Joined: Thu Dec 13, 2012 05:11
Location: Earth

by jojoa1997 » Post

The only benefit is you could call a mod with a name you want instead of 0~~~~~ if you want the mod too
Load first.
Coding;
1X coding
3X debugging
12X tweaking to be just right

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

jojoa1997 wrote:The only benefit is you could call a mod with a name you want instead of 0~~~~~ if you want the mod too
Load first.
Yes, but whats the benefit of loading your mod first?

User avatar
Zeg9
Member
Posts: 608
Joined: Fri Sep 21, 2012 11:02
Location: France

by Zeg9 » Post

PilzAdam wrote:
jojoa1997 wrote:The only benefit is you could call a mod with a name you want instead of 0~~~~~ if you want the mod too
Load first.
Yes, but whats the benefit of loading your mod first?
Maybe he tries to override a minetest.* function (is this possible?).
IIRC they do that in the craft guide mod.
I made a few (a lot of?) mods for minetest: here is a list.
See also the MT-Faithful texture pack (work in progress).

User avatar
LionsDen
Member
Posts: 530
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Post

If you want to override a function, wouldn't you have to have it load after the original function or else the original function would override it when it loads? I haven't tried to do this so I don't know but I have overridden some nodes and that is the order they need to be done in. First the original node loads and then my override loads overwriting the original node.

Nore
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

I see at least one use for that: once I wanted a mod that added tin to remove that silly bronze recipe, for that the mod had to load before default. The same thing can be used if one wants a mod to change a craft or delete a default node or change an ABM, that can't be done without that.

User avatar
rubenwardy
Moderator
Posts: 6107
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

by rubenwardy » Post

Most functions in minetest.* are defined in cpp, or built in.

My mod debugger overrides some functions.
Last edited by rubenwardy on Wed Sep 18, 2013 08:12, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests