mirror of
https://github.com/minetest/minetest.git
synced 2024-12-12 09:23:15 +01:00
Apply various fixes to several things
This commit is contained in:
parent
6b3169e4d0
commit
9e100bc42b
@ -1123,7 +1123,7 @@ minetest.get_mapgen_object(objectname)
|
|||||||
^ Return requested mapgen object if available (see Mapgen objects)
|
^ Return requested mapgen object if available (see Mapgen objects)
|
||||||
minetest.set_mapgen_params(MapgenParams)
|
minetest.set_mapgen_params(MapgenParams)
|
||||||
^ Set map generation parameters
|
^ 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.
|
^ Takes a table as an argument with the fields mgname, seed, water_level, flags, and flagmask.
|
||||||
^ Leave field unset to leave that parameter unchanged
|
^ Leave field unset to leave that parameter unchanged
|
||||||
^ flagmask field must be set to all mapgen flags that are being modified
|
^ flagmask field must be set to all mapgen flags that are being modified
|
||||||
|
@ -579,6 +579,8 @@ int ModApiEnvMod::l_get_mapgen_object(lua_State *L)
|
|||||||
|
|
||||||
EmergeManager *emerge = getServer(L)->getEmergeManager();
|
EmergeManager *emerge = getServer(L)->getEmergeManager();
|
||||||
Mapgen *mg = emerge->getCurrentMapgen();
|
Mapgen *mg = emerge->getCurrentMapgen();
|
||||||
|
if (!mg)
|
||||||
|
return 0;
|
||||||
|
|
||||||
size_t maplen = mg->csize.X * mg->csize.Z;
|
size_t maplen = mg->csize.X * mg->csize.Z;
|
||||||
|
|
||||||
@ -614,7 +616,7 @@ int ModApiEnvMod::l_get_mapgen_object(lua_State *L)
|
|||||||
}
|
}
|
||||||
break; }
|
break; }
|
||||||
case MGOBJ_BIOMEMAP: {
|
case MGOBJ_BIOMEMAP: {
|
||||||
if (!mg->heightmap)
|
if (!mg->biomemap)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
@ -625,6 +627,9 @@ int ModApiEnvMod::l_get_mapgen_object(lua_State *L)
|
|||||||
break; }
|
break; }
|
||||||
case MGOBJ_HEATMAP: { // Mapgen V7 specific objects
|
case MGOBJ_HEATMAP: { // Mapgen V7 specific objects
|
||||||
case MGOBJ_HUMIDMAP:
|
case MGOBJ_HUMIDMAP:
|
||||||
|
if (strcmp(emerge->params->mg_name.c_str(), "v7"))
|
||||||
|
return 0;
|
||||||
|
|
||||||
MapgenV7 *mgv7 = (MapgenV7 *)mg;
|
MapgenV7 *mgv7 = (MapgenV7 *)mg;
|
||||||
|
|
||||||
float *arr = (mgobj == MGOBJ_HEATMAP) ?
|
float *arr = (mgobj == MGOBJ_HEATMAP) ?
|
||||||
|
@ -88,7 +88,7 @@ int LuaVoxelManip::l_set_data(lua_State *L)
|
|||||||
int volume = vm->m_area.getVolume();
|
int volume = vm->m_area.getVolume();
|
||||||
for (int i = 0; i != volume; i++) {
|
for (int i = 0; i != volume; i++) {
|
||||||
lua_rawgeti(L, 2, i + 1);
|
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);
|
vm->m_data[i].setContent(c);
|
||||||
|
|
||||||
@ -224,7 +224,11 @@ int LuaVoxelManip::create_object(lua_State *L)
|
|||||||
{
|
{
|
||||||
NO_MAP_LOCK_REQUIRED;
|
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);
|
LuaVoxelManip *o = new LuaVoxelManip(map);
|
||||||
|
|
||||||
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
|
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
|
||||||
|
Loading…
Reference in New Issue
Block a user