diff options
-rw-r--r-- | src/emerge.cpp | 6 | ||||
-rw-r--r-- | src/emerge.h | 1 | ||||
-rw-r--r-- | src/script/lua_api/l_mapgen.cpp | 10 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/emerge.cpp b/src/emerge.cpp index bb2590641..92edd2007 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -256,6 +256,12 @@ void EmergeManager::stopThreads() } +bool EmergeManager::isRunning() +{ + return m_threads_active; +} + + bool EmergeManager::enqueueBlockEmerge( u16 peer_id, v3s16 blockpos, diff --git a/src/emerge.h b/src/emerge.h index b72b2a2c3..47ff218b8 100644 --- a/src/emerge.h +++ b/src/emerge.h @@ -115,6 +115,7 @@ public: void startThreads(); void stopThreads(); + bool isRunning(); bool enqueueBlockEmerge( u16 peer_id, diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp index 44af7892f..cfa216a3d 100644 --- a/src/script/lua_api/l_mapgen.cpp +++ b/src/script/lua_api/l_mapgen.cpp @@ -619,7 +619,11 @@ int ModApiMapgen::l_set_mapgen_params(lua_State *L) if (!lua_istable(L, 1)) return 0; - MapgenParams *params = &getServer(L)->getEmergeManager()->params; + EmergeManager *emerge = getServer(L)->getEmergeManager(); + if (emerge->isRunning()) + throw LuaError("Cannot set parameters while mapgen is running"); + + MapgenParams *params = &emerge->params; u32 flags = 0, flagmask = 0; lua_getfield(L, 1, "mgname"); @@ -637,6 +641,10 @@ int ModApiMapgen::l_set_mapgen_params(lua_State *L) if (lua_isnumber(L, -1)) params->water_level = lua_tointeger(L, -1); + lua_getfield(L, 1, "chunksize"); + if (lua_isnumber(L, -1)) + params->chunksize = lua_tointeger(L, -1); + warn_if_field_exists(L, 1, "flagmask", "Deprecated: flags field now includes unset flags."); lua_getfield(L, 1, "flagmask"); |