diff options
Diffstat (limited to 'src/script/lua_api/l_mapgen.cpp')
-rw-r--r-- | src/script/lua_api/l_mapgen.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp index 76e94e97e..57090a58f 100644 --- a/src/script/lua_api/l_mapgen.cpp +++ b/src/script/lua_api/l_mapgen.cpp @@ -637,6 +637,20 @@ int ModApiMapgen::l_set_noiseparams(lua_State *L) } +// get_noiseparams(name) +int ModApiMapgen::l_get_noiseparams(lua_State *L) +{ + std::string name = luaL_checkstring(L, 1); + + NoiseParams np; + if (!g_settings->getNoiseParams(name, np)) + return 0; + + push_noiseparams(L, &np); + return 1; +} + + // set_gen_notify(flags, {deco_id_table}) int ModApiMapgen::l_set_gen_notify(lua_State *L) { @@ -661,6 +675,25 @@ int ModApiMapgen::l_set_gen_notify(lua_State *L) } +// get_gen_notify() +int ModApiMapgen::l_get_gen_notify(lua_State *L) +{ + EmergeManager *emerge = getServer(L)->getEmergeManager(); + push_flags_string(L, flagdesc_gennotify, emerge->gen_notify_on, + emerge->gen_notify_on); + + lua_newtable(L); + int i = 1; + for (std::set<u32>::iterator it = emerge->gen_notify_on_deco_ids.begin(); + it != emerge->gen_notify_on_deco_ids.end(); ++it) { + lua_pushnumber(L, *it); + lua_rawseti(L, -2, i); + i++; + } + return 2; +} + + // register_biome({lots of stuff}) int ModApiMapgen::l_register_biome(lua_State *L) { @@ -1187,7 +1220,9 @@ void ModApiMapgen::Initialize(lua_State *L, int top) API_FCT(get_mapgen_params); API_FCT(set_mapgen_params); API_FCT(set_noiseparams); + API_FCT(get_noiseparams); API_FCT(set_gen_notify); + API_FCT(get_gen_notify); API_FCT(register_biome); API_FCT(register_decoration); |