diff options
author | kwolekr <kwolekr@minetest.net> | 2015-10-04 17:26:08 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-10-04 17:26:08 -0400 |
commit | 5130dbce7b294c392733e93c05e2099786523342 (patch) | |
tree | f00a35c9f41ffbd0917801d1b4d10b4ce917dcc9 /src/script/lua_api | |
parent | 9f25aba6c2c3a922ebe74c327e275e83fef1f6f6 (diff) | |
download | minetest-5130dbce7b294c392733e93c05e2099786523342.tar.gz minetest-5130dbce7b294c392733e93c05e2099786523342.tar.bz2 minetest-5130dbce7b294c392733e93c05e2099786523342.zip |
Allow setting chunksize in core.set_mapgen_params
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_mapgen.cpp | 10 |
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"); |