diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 27 | ||||
-rw-r--r-- | src/scriptapi.cpp | 9 | ||||
-rw-r--r-- | src/server.h | 2 | ||||
-rw-r--r-- | src/servermain.cpp | 18 |
4 files changed, 41 insertions, 15 deletions
diff --git a/src/main.cpp b/src/main.cpp index 6cb9cf984..2875474f1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1085,22 +1085,31 @@ int main(int argc, char *argv[]) // List all allowed options core::map<std::string, ValueSpec> allowed_options; - allowed_options.insert("help", ValueSpec(VALUETYPE_FLAG)); + allowed_options.insert("help", ValueSpec(VALUETYPE_FLAG, + "Show allowed options")); allowed_options.insert("server", ValueSpec(VALUETYPE_FLAG, "Run server directly")); allowed_options.insert("config", ValueSpec(VALUETYPE_STRING, "Load configuration from specified file")); - allowed_options.insert("port", ValueSpec(VALUETYPE_STRING)); - allowed_options.insert("address", ValueSpec(VALUETYPE_STRING)); - allowed_options.insert("random-input", ValueSpec(VALUETYPE_FLAG)); - allowed_options.insert("disable-unittests", ValueSpec(VALUETYPE_FLAG)); - allowed_options.insert("enable-unittests", ValueSpec(VALUETYPE_FLAG)); - allowed_options.insert("map-dir", ValueSpec(VALUETYPE_STRING)); + allowed_options.insert("port", ValueSpec(VALUETYPE_STRING, + "Set network port to connect to")); + allowed_options.insert("address", ValueSpec(VALUETYPE_STRING, + "Address to connect to")); + allowed_options.insert("random-input", ValueSpec(VALUETYPE_FLAG, + "Enable random user input, for testing")); + allowed_options.insert("disable-unittests", ValueSpec(VALUETYPE_FLAG, + "Disable unit tests")); + allowed_options.insert("enable-unittests", ValueSpec(VALUETYPE_FLAG, + "Enable unit tests")); + allowed_options.insert("map-dir", ValueSpec(VALUETYPE_STRING, + "Map directory (where everything in the world is stored)")); #ifdef _WIN32 allowed_options.insert("dstream-on-stderr", ValueSpec(VALUETYPE_FLAG)); #endif - allowed_options.insert("speedtests", ValueSpec(VALUETYPE_FLAG)); - allowed_options.insert("info-on-stderr", ValueSpec(VALUETYPE_FLAG)); + allowed_options.insert("speedtests", ValueSpec(VALUETYPE_FLAG, + "Run speed tests")); + allowed_options.insert("info-on-stderr", ValueSpec(VALUETYPE_FLAG, + "Print debug information to console")); Settings cmd_args; diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index a064cd688..8350c75f1 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -3560,6 +3560,14 @@ static int l_get_modpath(lua_State *L) return 1; } +// get_worldpath() +static int l_get_worldpath(lua_State *L) +{ + std::string worldpath = get_server(L)->getWorldPath(); + lua_pushstring(L, worldpath.c_str()); + return 1; +} + static const struct luaL_Reg minetest_f [] = { {"debug", l_debug}, {"log", l_log}, @@ -3576,6 +3584,7 @@ static const struct luaL_Reg minetest_f [] = { {"get_hitting_properties", l_get_hitting_properties}, {"get_current_modname", l_get_current_modname}, {"get_modpath", l_get_modpath}, + {"get_worldpath", l_get_worldpath}, {NULL, NULL} }; diff --git a/src/server.h b/src/server.h index 40f0fe582..04bd61a87 100644 --- a/src/server.h +++ b/src/server.h @@ -525,6 +525,8 @@ public: IWritableCraftDefManager* getWritableCraftDefManager(); const ModSpec* getModSpec(const std::string &modname); + + std::string getWorldPath(){ return m_mapsavedir; } private: diff --git a/src/servermain.cpp b/src/servermain.cpp index 3ef1d9479..7a05bb964 100644 --- a/src/servermain.cpp +++ b/src/servermain.cpp @@ -203,14 +203,20 @@ int main(int argc, char *argv[]) // List all allowed options core::map<std::string, ValueSpec> allowed_options; - allowed_options.insert("help", ValueSpec(VALUETYPE_FLAG)); + allowed_options.insert("help", ValueSpec(VALUETYPE_FLAG, + "Show allowed options")); allowed_options.insert("config", ValueSpec(VALUETYPE_STRING, "Load configuration from specified file")); - allowed_options.insert("port", ValueSpec(VALUETYPE_STRING)); - allowed_options.insert("disable-unittests", ValueSpec(VALUETYPE_FLAG)); - allowed_options.insert("enable-unittests", ValueSpec(VALUETYPE_FLAG)); - allowed_options.insert("map-dir", ValueSpec(VALUETYPE_STRING)); - allowed_options.insert("info-on-stderr", ValueSpec(VALUETYPE_FLAG)); + allowed_options.insert("port", ValueSpec(VALUETYPE_STRING, + "Set network port (UDP) to use")); + allowed_options.insert("disable-unittests", ValueSpec(VALUETYPE_FLAG, + "Disable unit tests")); + allowed_options.insert("enable-unittests", ValueSpec(VALUETYPE_FLAG, + "Enable unit tests")); + allowed_options.insert("map-dir", ValueSpec(VALUETYPE_STRING, + "Map directory (where everything in the world is stored)")); + allowed_options.insert("info-on-stderr", ValueSpec(VALUETYPE_FLAG, + "Print debug information to console")); Settings cmd_args; |