From c0335f7d13ee46c6a46d0ceebea96960439ec9fd Mon Sep 17 00:00:00 2001 From: TeTpaAka Date: Tue, 26 May 2015 14:10:08 +0200 Subject: Add some missing getter functions to the lua API ObjectRef: get_properties get_armor_groups get_animation get_attach get_bone_position Players: get_physics_override hud_get_hotbar_itemcount hud_get_hotbar_image hud_get_hotbar_selected_image get_sky get_day_night_ratio get_local_animation get_eye_offset Global: minetest.get_gen_notify minetest.get_noiseparams --- src/script/lua_api/l_mapgen.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/script/lua_api/l_mapgen.cpp') 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::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); -- cgit v1.2.3