Add minetest.get_gen_notify to mapgen env (#14568)

This commit is contained in:
sfan5 2024-04-30 13:50:18 +02:00 committed by GitHub
parent 2bdd0a6bdb
commit ac4f13e78f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1052,14 +1052,15 @@ int ModApiMapgen::l_get_gen_notify(lua_State *L)
{ {
NO_MAP_LOCK_REQUIRED; NO_MAP_LOCK_REQUIRED;
EmergeManager *emerge = getServer(L)->getEmergeManager(); auto *emerge = getEmergeManager(L);
push_flags_string(L, flagdesc_gennotify, emerge->gen_notify_on, push_flags_string(L, flagdesc_gennotify, emerge->gen_notify_on,
emerge->gen_notify_on); emerge->gen_notify_on);
lua_createtable(L, emerge->gen_notify_on_deco_ids.size(), 0); lua_createtable(L, emerge->gen_notify_on_deco_ids.size(), 0);
int i = 1; int i = 1;
for (u32 id : emerge->gen_notify_on_deco_ids) { for (u32 id : emerge->gen_notify_on_deco_ids) {
lua_pushnumber(L, id); lua_pushinteger(L, id);
lua_rawseti(L, -2, i++); lua_rawseti(L, -2, i++);
} }
@ -2054,6 +2055,7 @@ void ModApiMapgen::InitializeEmerge(lua_State *L, int top)
API_FCT(get_mapgen_setting); API_FCT(get_mapgen_setting);
API_FCT(get_mapgen_setting_noiseparams); API_FCT(get_mapgen_setting_noiseparams);
API_FCT(get_noiseparams); API_FCT(get_noiseparams);
API_FCT(get_gen_notify);
API_FCT(get_decoration_id); API_FCT(get_decoration_id);
API_FCT(save_gen_notify); API_FCT(save_gen_notify);