^ Return requested mapgen object if available (see Mapgen objects)
minetest.set_mapgen_params(MapgenParams)
^ Set map generation parameters
-^ Function can *only* be called within a minetest.on_mapgen_init() callback
+^ Function cannot be called after the registration period; only initialization and on_mapgen_init
^ Takes a table as an argument with the fields mgname, seed, water_level, flags, and flagmask.
^ Leave field unset to leave that parameter unchanged
^ flagmask field must be set to all mapgen flags that are being modified
this->biomedef = new BiomeDefManager();
this->params = NULL;
- this->luaoverride_params = NULL;
+ this->luaoverride_params = NULL;
this->luaoverride_params_modified = 0;
- this->luaoverride_flagmask = 0;
+ this->luaoverride_flagmask = 0;
mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
EmergeManager *emerge = getServer(L)->getEmergeManager();
Mapgen *mg = emerge->getCurrentMapgen();
+ if (!mg)
+ return 0;
size_t maplen = mg->csize.X * mg->csize.Z;
}
break; }
case MGOBJ_BIOMEMAP: {
- if (!mg->heightmap)
+ if (!mg->biomemap)
return 0;
lua_newtable(L);
break; }
case MGOBJ_HEATMAP: { // Mapgen V7 specific objects
case MGOBJ_HUMIDMAP:
+ if (strcmp(emerge->params->mg_name.c_str(), "v7"))
+ return 0;
+
MapgenV7 *mgv7 = (MapgenV7 *)mg;
float *arr = (mgobj == MGOBJ_HEATMAP) ?
int volume = vm->m_area.getVolume();
for (int i = 0; i != volume; i++) {
lua_rawgeti(L, 2, i + 1);
- content_t c = lua_tonumber(L, -1);
+ content_t c = lua_tointeger(L, -1);
vm->m_data[i].setContent(c);
{
NO_MAP_LOCK_REQUIRED;
- Map *map = &(get_scriptapi(L)->getEnv()->getMap());
+ Environment *env = get_scriptapi(L)->getEnv();
+ if (!env)
+ return 0;
+
+ Map *map = &(env->getMap());
LuaVoxelManip *o = new LuaVoxelManip(map);
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;