diff --git a/CMakeLists.txt b/CMakeLists.txt index f2951a1..944ab1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ else() endif() message("II SOLANACEAE_SDBOT_WEBUI_STANDALONE " ${SOLANACEAE_SDBOT_WEBUI_STANDALONE}) -option(SOLANACEAE_SDBOT_WEBUI_BUILD_PLUGINS "Build the toxic_games plugins" ${SOLANACEAE_SDBOT_WEBUI_STANDALONE}) +option(SOLANACEAE_SDBOT_WEBUI_BUILD_PLUGINS "Build the SDBot-webui plugin" ${SOLANACEAE_SDBOT_WEBUI_STANDALONE}) if (SOLANACEAE_SDBOT_WEBUI_STANDALONE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff --git a/plugins/plugin_sdbot-webui.cpp b/plugins/plugin_sdbot-webui.cpp index 40f05b0..4036528 100644 --- a/plugins/plugin_sdbot-webui.cpp +++ b/plugins/plugin_sdbot-webui.cpp @@ -68,10 +68,10 @@ SOLANA_PLUGIN_EXPORT void solana_plugin_stop(void) { g_sdbot.reset(); } -SOLANA_PLUGIN_EXPORT void solana_plugin_tick(float delta) { +SOLANA_PLUGIN_EXPORT float solana_plugin_tick(float delta) { (void)delta; //std::cout << "PLUGIN SDB TICK()\n"; - g_sdbot->iterate(); + return g_sdbot->iterate(); } } // extern C diff --git a/src/sd_bot.cpp b/src/sd_bot.cpp index 1155c37..6a29422 100644 --- a/src/sd_bot.cpp +++ b/src/sd_bot.cpp @@ -41,7 +41,7 @@ SDBot::SDBot( SDBot::~SDBot(void) { } -void SDBot::iterate(void) { +float SDBot::iterate(void) { if (static_cast(_con) && _con->outstanding()) { _con->pump(); } else if (!_prompt_queue.empty()) { // dequeue new task @@ -109,6 +109,9 @@ void SDBot::iterate(void) { _prompt_queue.pop(); } + + // if active web connection, 5ms + return static_cast(_con) ? 0.005f : 1.f; } bool SDBot::onEvent(const Message::Events::MessageConstruct& e) { diff --git a/src/sd_bot.hpp b/src/sd_bot.hpp index 7f01ea2..d43a33d 100644 --- a/src/sd_bot.hpp +++ b/src/sd_bot.hpp @@ -41,7 +41,7 @@ class SDBot : public RegistryMessageModelEventI { ); ~SDBot(void); - void iterate(void); + float iterate(void); public: // conf bool use_webp_for_friends = true;