Skip to content
Permalink
Browse files

Allow setting chunksize in core.set_mapgen_params

  • Loading branch information
kwolekr committed Oct 4, 2015
1 parent 9f25aba commit 5130dbce7b294c392733e93c05e2099786523342
Showing with 16 additions and 1 deletion.
  1. +6 −0 src/emerge.cpp
  2. +1 −0 src/emerge.h
  3. +9 −1 src/script/lua_api/l_mapgen.cpp
@@ -256,6 +256,12 @@ void EmergeManager::stopThreads()
}


bool EmergeManager::isRunning()
{
return m_threads_active;
}


bool EmergeManager::enqueueBlockEmerge(
u16 peer_id,
v3s16 blockpos,
@@ -115,6 +115,7 @@ class EmergeManager {

void startThreads();
void stopThreads();
bool isRunning();

bool enqueueBlockEmerge(
u16 peer_id,
@@ -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");

0 comments on commit 5130dbc

Please sign in to comment.