Change find_surface_nodes_in_area to find_nodes_in_area_under_air

This commit is contained in:
Craig Robbins 2015-02-27 21:42:00 +10:00
parent 0f556d0c7f
commit fdb9140825
3 changed files with 19 additions and 11 deletions

@ -1869,7 +1869,7 @@ and `minetest.auth_reload` call the authetification handler.
* `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
* `minetest.find_nodes_in_area(minp, maxp, nodenames)`: returns a list of positions
* `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
* `minetest.find_surface_nodes_in_area(minp, maxp, nodenames)`: returns a list of positions
* `minetest.find_nodes_in_area_under_air(minp, maxp, nodenames)`: returns a list of positions
* returned positions are nodes with a node air above
* `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
* `minetest.get_perlin(noiseparams)`

@ -570,16 +570,24 @@ int ModApiEnvMod::l_find_nodes_in_area(lua_State *L)
return 1;
}
// find_surface_nodes_in_area(minp, maxp, nodenames) -> list of positions
// nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
int ModApiEnvMod::l_find_surface_nodes_in_area(lua_State *L)
// find_nodes_in_area_under_air(minp, maxp, nodenames) -> list of positions
// nodenames: e.g. {"ignore", "group:tree"} or "default:dirt"
int ModApiEnvMod::l_find_nodes_in_area_under_air(lua_State *L)
{
/* Note: A similar but generalized (and therefore slower) version of this
* function could be created -- e.g. find_nodes_in_area_under -- which
* would accept a node name (or ID?) or list of names that the "above node"
* should be.
* TODO
*/
GET_ENV_PTR;
INodeDefManager *ndef = getServer(L)->ndef();
v3s16 minp = read_v3s16(L, 1);
v3s16 maxp = read_v3s16(L, 2);
std::set<content_t> filter;
if (lua_istable(L, 3)) {
int table = 3;
lua_pushnil(L);
@ -912,7 +920,7 @@ void ModApiEnvMod::Initialize(lua_State *L, int top)
API_FCT(get_gametime);
API_FCT(find_node_near);
API_FCT(find_nodes_in_area);
API_FCT(find_surface_nodes_in_area);
API_FCT(find_nodes_in_area_under_air);
API_FCT(delete_area);
API_FCT(get_perlin);
API_FCT(get_perlin_map);

@ -121,7 +121,7 @@ private:
// find_surface_nodes_in_area(minp, maxp, nodenames) -> list of positions
// nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
static int l_find_surface_nodes_in_area(lua_State *L);
static int l_find_nodes_in_area_under_air(lua_State *L);
// delete_area(p1, p2) -> true/false
static int l_delete_area(lua_State *L);