mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Add option for random mod load order (#14637)
This commit is contained in:
parent
57b6e74abb
commit
0889048cb5
3 changed files with 18 additions and 0 deletions
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "filesys.h"
|
||||
#include "gettext.h"
|
||||
#include "exceptions.h"
|
||||
#include "util/numeric.h"
|
||||
|
||||
|
||||
std::string ModConfiguration::getUnsatisfiedModsError() const
|
||||
|
@ -226,6 +227,15 @@ void ModConfiguration::resolveDependencies()
|
|||
modnames.insert(mod.name);
|
||||
}
|
||||
|
||||
// Step 1.5 (optional): shuffle unsatisfied mods so non declared depends get found by their devs
|
||||
if (g_settings->getBool("random_mod_load_order")) {
|
||||
MyRandGenerator rg;
|
||||
std::shuffle(m_unsatisfied_mods.begin(),
|
||||
m_unsatisfied_mods.end(),
|
||||
rg
|
||||
);
|
||||
}
|
||||
|
||||
// Step 2: get dependencies (including optional dependencies)
|
||||
// of each mod, split mods into satisfied and unsatisfied
|
||||
std::vector<ModSpec> satisfied;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue