aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_mapgen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api/l_mapgen.cpp')
-rw-r--r--src/script/lua_api/l_mapgen.cpp10
1 files changed, 9 insertions, 1 deletions
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");