From 3c63c3044d5e4ca36c2649c530f31622581d90fd Mon Sep 17 00:00:00 2001 From: kwolekr Date: Fri, 24 Jun 2016 18:15:56 -0400 Subject: Add MapSettingsManager and new mapgen setting script API functions This commit refactors the majority of the Mapgen settings system. - MapgenParams is now owned by MapSettingsManager, itself a part of ServerMap, instead of the EmergeManager. - New Script API functions added: core.get_mapgen_setting core.get_mapgen_setting_noiseparams, core.set_mapgen_setting, and core.set_mapgen_setting_noiseparams. - minetest.get/set_mapgen_params are deprecated by the above new functions. - It is now possible to view and modify any arbitrary mapgen setting from a mod, rather than the base MapgenParams structure. - MapgenSpecificParams has been removed. --- src/script/lua_api/l_vmanip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/script/lua_api/l_vmanip.cpp') diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp index f13866408..0d8123acd 100644 --- a/src/script/lua_api/l_vmanip.cpp +++ b/src/script/lua_api/l_vmanip.cpp @@ -190,7 +190,7 @@ int LuaVoxelManip::l_calc_lighting(lua_State *L) Mapgen mg; mg.vm = vm; mg.ndef = ndef; - mg.water_level = emerge->params.water_level; + mg.water_level = emerge->mgparams->water_level; mg.calcLighting(pmin, pmax, fpmin, fpmax, propagate_shadow); -- cgit v1.2.3 From 70e2df4f86cf4101a10c7e1f7a6ac5cc03992793 Mon Sep 17 00:00:00 2001 From: paramat Date: Sat, 29 Oct 2016 15:22:18 +0100 Subject: Lua voxelmanip: Add optional buffer param for 'get param2 data' Update lua_api.txt. --- doc/lua_api.txt | 4 +++- src/script/lua_api/l_vmanip.cpp | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/script/lua_api/l_vmanip.cpp') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 43ff66bb9..da90f93d2 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3263,7 +3263,9 @@ will place the schematic inside of the VoxelManip. * `set_light_data(light_data)`: Sets the `param1` (light) contents of each node in the `VoxelManip` * expects lighting data in the same format that `get_light_data()` returns -* `get_param2_data()`: Gets the raw `param2` data read into the `VoxelManip` object +* `get_param2_data([buffer])`: Gets the raw `param2` data read into the `VoxelManip` object + * Returns an array (indices 1 to volume) of integers ranging from `0` to `255` + * If the param `buffer` is present, this table will be used to store the result instead * `set_param2_data(param2_data)`: Sets the `param2` contents of each node in the `VoxelManip` * `calc_lighting([p1, p2], [propagate_shadow])`: Calculate lighting within the `VoxelManip` * To be used only by a `VoxelManip` object from `minetest.get_mapgen_object` diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp index 0d8123acd..bdf720f0a 100644 --- a/src/script/lua_api/l_vmanip.cpp +++ b/src/script/lua_api/l_vmanip.cpp @@ -277,11 +277,17 @@ int LuaVoxelManip::l_get_param2_data(lua_State *L) NO_MAP_LOCK_REQUIRED; LuaVoxelManip *o = checkobject(L, 1); + bool use_buffer = lua_istable(L, 2); + MMVManip *vm = o->vm; u32 volume = vm->m_area.getVolume(); - lua_newtable(L); + if (use_buffer) + lua_pushvalue(L, 2); + else + lua_newtable(L); + for (u32 i = 0; i != volume; i++) { lua_Integer param2 = vm->m_data[i].param2; lua_pushinteger(L, param2); -- cgit v1.2.3