1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-11-04 16:35:03 -05:00

Allow setting chunksize in core.set_mapgen_params

This commit is contained in:
kwolekr 2015-10-04 17:26:08 -04:00
parent 9f25aba6c2
commit 5130dbce7b
3 changed files with 16 additions and 1 deletions

View File

@ -256,6 +256,12 @@ void EmergeManager::stopThreads()
}
bool EmergeManager::isRunning()
{
return m_threads_active;
}
bool EmergeManager::enqueueBlockEmerge(
u16 peer_id,
v3s16 blockpos,

View File

@ -115,6 +115,7 @@ public:
void startThreads();
void stopThreads();
bool isRunning();
bool enqueueBlockEmerge(
u16 peer_id,

View File

@ -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");