From 4530370e52c4c92cd5a4a457a58200ad120af010 Mon Sep 17 00:00:00 2001 From: Koncord Date: Thu, 19 Oct 2017 11:55:49 +0800 Subject: [PATCH] [Server] Use old style of Server Plugins location --- apps/openmw-mp/Script/LuaState.cpp | 15 ++------------- apps/openmw-mp/Script/LuaState.hpp | 2 +- apps/openmw-mp/main.cpp | 11 +++-------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/apps/openmw-mp/Script/LuaState.cpp b/apps/openmw-mp/Script/LuaState.cpp index 02edb8044..032f80d7b 100644 --- a/apps/openmw-mp/Script/LuaState.cpp +++ b/apps/openmw-mp/Script/LuaState.cpp @@ -438,7 +438,7 @@ vector::iterator> loadOrderSolver(vector *list) +void LuaState::loadMods(const std::string &modDir, std::vector *list) { using namespace boost::filesystem; @@ -480,26 +480,15 @@ void LuaState::loadMods(std::vector *list) #endif - path envServerDir = std::getenv("TES3MP_SERVER_DIR"); - const char *envServerUserDir = std::getenv("TES3MP_SERVER_USERDIR"); + path envServerDir = modDir; if (envServerDir.empty()) - { envServerDir = current_path(); - setenv("TES3MP_SERVER_DIR", envServerDir.string().c_str(), 1); - } addGlobalPackagePath(envServerDir.string() + "/lib/lua/?/init.lua;" + envServerDir.string() + "/lib/lua/?.lua"); addGlobalCPath(envServerDir.string() + "lib/?" + libExt); readConfig(envServerDir); - if (envServerUserDir != nullptr) - { - readConfig(envServerUserDir); - addGlobalPackagePath(string(envServerUserDir) + "/lib/lua/?/init.lua;" + string(envServerUserDir) + "/lib/lua/?.lua"); - } - - vector::iterator> sortedPluginList; if (list != nullptr && !list->empty()) // manual sorted list { diff --git a/apps/openmw-mp/Script/LuaState.hpp b/apps/openmw-mp/Script/LuaState.hpp index 94b6dbe85..879f4aba2 100644 --- a/apps/openmw-mp/Script/LuaState.hpp +++ b/apps/openmw-mp/Script/LuaState.hpp @@ -36,7 +36,7 @@ public: void addGlobalCPath(const std::string &path); sol::table getCoreTable() { return dataEnv["Core"]; } sol::environment &getDataEnv(){ return dataEnv; } - void loadMods(std::vector *list = nullptr); + void loadMods(const std::string &path, std::vector *list = nullptr); CommandController &getCmdCtrl(); EventController &getEventCtrl(); diff --git a/apps/openmw-mp/main.cpp b/apps/openmw-mp/main.cpp index 96e4a7e7e..ef6ea55c5 100644 --- a/apps/openmw-mp/main.cpp +++ b/apps/openmw-mp/main.cpp @@ -191,11 +191,6 @@ int main(int argc, char *argv[]) string passw = mgr.getString("password", "General"); - string plugin_home = mgr.getString("home", "Plugins"); - string moddir = Utils::convertPath(plugin_home + "/data"); - - vector plugins (Utils::split(mgr.getString("plugins", "Plugins"), ',')); - Utils::printVersion("TES3MP dedicated server", TES3MP_VERSION, version.mCommitHash, TES3MP_PROTO_VERSION); int code; @@ -246,10 +241,10 @@ int main(int argc, char *argv[]) Networking networking(peer); - + string plugin_home = mgr.getString("home", "Plugins"); if (mgr.getBool("autoSort", "Plugins")) - networking.getState().loadMods(); + networking.getState().loadMods(plugin_home); else { std::vector list; @@ -261,7 +256,7 @@ int main(int argc, char *argv[]) } catch (...) {} // Manager::getString throws runtime_error exception if setting is not exist - networking.getState().loadMods(&list); + networking.getState().loadMods(plugin_home, &list); }