MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / updateMods

Method updateMods

source/client/StarClientApplication.cpp:798–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

796}
797
798void ClientApplication::updateMods(float dt) {
799 m_cinematicOverlay->update(dt);
800 auto ugcService = appController()->userGeneratedContentService();
801 auto configuration = m_root->configuration();
802 bool includeUGC = configuration->get("includeUGC", m_root->settings().includeUGC).toBool();
803 if (ugcService && includeUGC) {
804 Logger::info("Checking for user generated content...");
805 if (ugcService->triggerContentDownload()) {
806 StringList modDirectories;
807 for (auto& contentId : ugcService->subscribedContentIds()) {
808 if (auto contentDirectory = ugcService->contentDownloadDirectory(contentId)) {
809 Logger::info("Loading mods from user generated content with id '{}' from directory '{}'", contentId, *contentDirectory);
810 modDirectories.append(*contentDirectory);
811 } else {
812 Logger::warn("User generated content with id '{}' is not available", contentId);
813 }
814 }
815
816 if (modDirectories.empty()) {
817 Logger::info("No subscribed user generated content");
818 changeState(MainAppState::Splash);
819 } else {
820 Logger::info("Reloading to include all user generated content");
821 Root::singleton().reloadWithMods(modDirectories);
822
823 auto assets = m_root->assets();
824
825 if (configuration->get("modsWarningShown").optBool().value()) {
826 changeState(MainAppState::Splash);
827 } else {
828 configuration->set("modsWarningShown", true);
829 m_errorScreen->setMessage(assets->json("/interface.config:modsWarningMessage").toString());
830 changeState(MainAppState::ModsWarning);
831 }
832 }
833 }
834 } else {
835 changeState(MainAppState::Splash);
836 }
837}
838
839void ClientApplication::updateModsWarning(float) {
840 if (m_errorScreen->accepted())

Callers

nothing calls this directly

Calls 15

singletonClass · 0.85
configurationMethod · 0.80
toBoolMethod · 0.80
subscribedContentIdsMethod · 0.80
reloadWithModsMethod · 0.80
assetsMethod · 0.80
optBoolMethod · 0.80
jsonMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected