optional sbinit option to disable UGC (workshop mods)

This commit is contained in:
Kae 2024-06-27 15:49:41 +10:00
parent 64adc28658
commit f60a19e065
4 changed files with 13 additions and 2 deletions

View File

@ -686,10 +686,11 @@ void ClientApplication::setError(String const& error, std::exception const& e) {
void ClientApplication::updateMods(float dt) { void ClientApplication::updateMods(float dt) {
m_cinematicOverlay->update(dt); m_cinematicOverlay->update(dt);
auto ugcService = appController()->userGeneratedContentService(); auto ugcService = appController()->userGeneratedContentService();
if (ugcService) { if (ugcService && m_root->settings().includeUGC) {
Logger::info("Checking for user generated content...");
if (ugcService->triggerContentDownload()) { if (ugcService->triggerContentDownload()) {
StringList modDirectories; StringList modDirectories;
for (auto contentId : ugcService->subscribedContentIds()) { for (auto& contentId : ugcService->subscribedContentIds()) {
if (auto contentDirectory = ugcService->contentDownloadDirectory(contentId)) { if (auto contentDirectory = ugcService->contentDownloadDirectory(contentId)) {
Logger::info("Loading mods from user generated content with id '{}' from directory '{}'", contentId, *contentDirectory); Logger::info("Loading mods from user generated content with id '{}' from directory '{}'", contentId, *contentDirectory);
modDirectories.append(*contentDirectory); modDirectories.append(*contentDirectory);

View File

@ -570,6 +570,10 @@ CollectionDatabaseConstPtr Root::collectionDatabase() {
return loadMember(m_collectionDatabase, m_collectionDatabaseMutex, "CollectionDatabase"); return loadMember(m_collectionDatabase, m_collectionDatabaseMutex, "CollectionDatabase");
} }
Root::Settings& Root::settings() {
return m_settings;
}
StringList Root::scanForAssetSources(StringList const& directories, StringList const& manual) { StringList Root::scanForAssetSources(StringList const& directories, StringList const& manual) {
struct AssetSource { struct AssetSource {
String path; String path;

View File

@ -88,6 +88,9 @@ public:
// given. // given.
bool quiet; bool quiet;
// If true, loads UGC from platform services if available. True by default.
bool includeUGC;
// If given, will write changed configuration to the given file within the // If given, will write changed configuration to the given file within the
// storage directory. // storage directory.
Maybe<String> runtimeConfigFile; Maybe<String> runtimeConfigFile;
@ -180,6 +183,8 @@ public:
RadioMessageDatabaseConstPtr radioMessageDatabase(); RadioMessageDatabaseConstPtr radioMessageDatabase();
CollectionDatabaseConstPtr collectionDatabase(); CollectionDatabaseConstPtr collectionDatabase();
Settings& settings();
private: private:
static StringList scanForAssetSources(StringList const& directories, StringList const& manual = {}); static StringList scanForAssetSources(StringList const& directories, StringList const& manual = {});
template <typename T, typename... Params> template <typename T, typename... Params>

View File

@ -176,6 +176,7 @@ Root::Settings RootLoader::rootSettingsForOptions(Options const& options) const
rootSettings.logDirectory = bootConfig.optString("logDirectory"); rootSettings.logDirectory = bootConfig.optString("logDirectory");
rootSettings.logFile = options.parameters.value("logfile").maybeFirst().orMaybe(m_defaults.logFile); rootSettings.logFile = options.parameters.value("logfile").maybeFirst().orMaybe(m_defaults.logFile);
rootSettings.logFileBackups = bootConfig.getUInt("logFileBackups", 10); rootSettings.logFileBackups = bootConfig.getUInt("logFileBackups", 10);
rootSettings.includeUGC = bootConfig.getBool("includeUGC", true);
if (auto ll = options.parameters.value("loglevel").maybeFirst()) if (auto ll = options.parameters.value("loglevel").maybeFirst())
rootSettings.logLevel = LogLevelNames.getLeft(*ll); rootSettings.logLevel = LogLevelNames.getLeft(*ll);