mirror of
https://github.com/minetest/minetest.git
synced 2024-09-20 07:20:46 +03:00
Add option for random mod load order (#14637)
This commit is contained in:
parent
57b6e74abb
commit
0889048cb5
@ -1761,6 +1761,9 @@ deprecated_lua_api_handling (Deprecated Lua API handling) enum log none,log,erro
|
|||||||
# Enable random user input (only used for testing).
|
# Enable random user input (only used for testing).
|
||||||
random_input (Random input) bool false
|
random_input (Random input) bool false
|
||||||
|
|
||||||
|
# Enable random mod loading (mainly used for testing).
|
||||||
|
random_mod_load_order (Random mod load order) bool false
|
||||||
|
|
||||||
# Enable mod channels support.
|
# Enable mod channels support.
|
||||||
enable_mod_channels (Mod channels) bool false
|
enable_mod_channels (Mod channels) bool false
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "filesys.h"
|
#include "filesys.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
|
#include "util/numeric.h"
|
||||||
|
|
||||||
|
|
||||||
std::string ModConfiguration::getUnsatisfiedModsError() const
|
std::string ModConfiguration::getUnsatisfiedModsError() const
|
||||||
@ -226,6 +227,15 @@ void ModConfiguration::resolveDependencies()
|
|||||||
modnames.insert(mod.name);
|
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)
|
// Step 2: get dependencies (including optional dependencies)
|
||||||
// of each mod, split mods into satisfied and unsatisfied
|
// of each mod, split mods into satisfied and unsatisfied
|
||||||
std::vector<ModSpec> satisfied;
|
std::vector<ModSpec> satisfied;
|
||||||
|
@ -419,6 +419,11 @@ void set_default_settings()
|
|||||||
// Server
|
// Server
|
||||||
settings->setDefault("disable_escape_sequences", "false");
|
settings->setDefault("disable_escape_sequences", "false");
|
||||||
settings->setDefault("strip_color_codes", "false");
|
settings->setDefault("strip_color_codes", "false");
|
||||||
|
#ifndef NDEBUG
|
||||||
|
settings->setDefault("random_mod_load_order", "true");
|
||||||
|
#else
|
||||||
|
settings->setDefault("random_mod_load_order", "false");
|
||||||
|
#endif
|
||||||
#if USE_PROMETHEUS
|
#if USE_PROMETHEUS
|
||||||
settings->setDefault("prometheus_listener_address", "127.0.0.1:30000");
|
settings->setDefault("prometheus_listener_address", "127.0.0.1:30000");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user