New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for mod that is loaded before any other mod #8934
Comments
Alternatives:
Overall idea: I fully support the request as-is, although I'll still have suggestions :P |
How mod loading order is defined now exactly? Alphabetically? By position in dependency tree? If this mod should work only for specific game, then |
Dependency tree. Line 336 in 23bd563
It adds mods with met dependencies to the list, and adds the left overs below as soon their dependencies are met. First entry is loaded first. This code does not know where the mod comes from (MTG/CSMs/world mods/regular mods). |
Did you read the issue? This mod would only be a part of games, not anything seperate. |
If it is called a mod, then it is supposed to be standalone thing. If it is a part of some game and have no meaning without it, then it should be included to some existing mod present in the game. |
CSS z-index-like priority value that's used for sorting when there are no dependencies: #8873 (comment) |
I don't really like the idea of I don't think a 100% full control over the mod loading order is neccessary. I suggested a special case for a “first game mod” because it will be important for most init stuff like I don't think defining a mod order even more detailed is neccessary. I kept the suggestion intentionally simple. I don't like dumping I intentionally named the mod “ |
If you really need some piece of code to be a mod and if it is always part of some specific game and it should always load first, then put it as hard dependency for every mod in this game. Problem can be solved using existing tools. If this solution doesn't suit you, then elaborate what additional requirements do you have. |
Won't work. Note that current mod loading order is kinda stupid. Game mods and user mods are “randomly” (ok, not really, but it looks chaotic) interspersed, so there's no guarantee that one mod will be definitely, 100% reliably, the first mod. |
If user mods and game mods don't depend on each other, then random load order of mods with satisfied dependencies should not be an issue. |
So no, you haven't read the issue, you don't understand how Minetest game-development works, and you don't know the slightest bit of context for why this is needed because of that. You expect answers when they've already been given in the first post:
Except any default behavior that the game overrides is not guaranteed to be applied to mods, and will result in inconsistent behavior because of that. |
This is exactly what I call "mod which will influence other mods, which are not directly depend on it".
This is why the game should not depend on mods outside of the game. |
It..it's not. Nothing inside the game is depending on an external mod. That doesn't mean us gamedevs don't still want to easily change all default nodedef settings (or any setting!) without looping through all definitions or making custom forks of every generic mod just for one tiny tweak that is easy to do with either a sane loading order or an 'init' type mod specific for games. Games are meant to be a foundation for other mods, let us do that. |
Sounds like you want to ruin current mod dependency architecture "just for one tweak". What do you mean by "foundation for other mods"? |
For the last time: This won't work. Making all game mods hard-depend on some init mod will NOT work. Because the current mod loading order is chaotic. After builtin is loaded, game mods and user-provided mods are “randomly” interspersed. So it's very possible that an user mod can be loaded BEFORE a game mod, including the init mod. A request to force the mod loading order to be builtin → game mods → user mods was rejected recently. |
To clarify: It's very impractical to force all user mods to depend on an arbitrary game mod name just for the init routines. Because the init mod name will likely be non-standard, so you can kiss good-bye to generic mods that want to be compatible with loads of games. Generic mods are very valuable. |
So is it impractical or not work at all?
If user mod has hard dependency on game mod, it should be loaded later. Dependency management will do ordering for you.
And this is OK for me. Assuming our goal is to provide smooth experience for player. Imagine that there is mod "more air" and games "MTG" and "Pixture".
I have seen rejected request #8933 meant by you. This request #8934 will be rejected for the same reason. Rubenwardy in #8933 stated it as "You should not be depending on the mod load order, only on dependencies" and this statement is applicable now too. |
Copy-pasting generic mod with different hard dependencies is a lesser evil compared to the hacking dependency resolution algorithm. |
I think it would be better to make item definitions use metatables to allow the defaults to be changed after registration, but before the game finishes loading This only solves your specific usecase, however |
👍 proposal seems useful and worth considering. |
also a mod that gets loaded after every other mod ? |
It's easy to run code after things are loaded, we have |
PR #14177 should fix this. |
Problem
If you need to have code that must run before any other mod, there's currently not really any reliable method to do so.
Specifically, for overwriting things like
minetest.nodedef_defaults
, it is very crucial to have this ability. Only very early in the mod loading does it make sense to overwrite the node definition defaults. If you already had 2-3 mods before you had the ability to overwrite things, then it is probably already too late.Not having this ability makes it practically impossible to overwrite
minetest.nodedef_defaults
(and similar) in a reasonable (!) way.Solution
Add support for a special mod (let's call it “
gameinit
”) that is treated specially by Minetest. If a mod with the namegameinit
is found in the game, then Minetest will make sure this mod is always loaded before all other game mods and user-selected mods (but afterbuiltin
). Apart from that, this will be a mod like any other.This mod must be a game mod, using the name for a regular mod must result in an error.
This will allow games to safely do their early initialization tasks like overwriting
minetest.nodedef_defaults
.Alternatives
Suggest them. :D
The text was updated successfully, but these errors were encountered: