| 796 | } |
| 797 | |
| 798 | void 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 | |
| 839 | void ClientApplication::updateModsWarning(float) { |
| 840 | if (m_errorScreen->accepted()) |
nothing calls this directly
no test coverage detected