mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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
This commit is contained in:
parent
990a96578f
commit
c0335f7d13
17 changed files with 665 additions and 8 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue