1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Determine light_propagates from paramtype

This commit is contained in:
Perttu Ahola 2011-12-04 03:45:02 +02:00
parent e8539d4dae
commit 3e95b8a158
5 changed files with 24 additions and 21 deletions

View file

@ -455,6 +455,18 @@ static void setfloatfield(lua_State *L, int table,
lua_setfield(L, table, fieldname);
}
static void warn_if_field_exists(lua_State *L, int table,
const char *fieldname, const std::string &message)
{
lua_getfield(L, table, fieldname);
if(!lua_isnil(L, -1)){
infostream<<script_get_backtrace(L)<<std::endl;
infostream<<"WARNING: field \""<<fieldname<<"\": "
<<message<<std::endl;
}
lua_pop(L, 1);
}
/*
Inventory stuff
*/
@ -1019,7 +1031,9 @@ static int l_register_node(lua_State *L)
// True for all ground-like things like stone and mud, false for eg. trees
getboolfield(L, nodedef_table, "is_ground_content", f.is_ground_content);
getboolfield(L, nodedef_table, "light_propagates", f.light_propagates);
f.light_propagates = (f.param_type == CPT_LIGHT);
warn_if_field_exists(L, nodedef_table, "light_propagates",
"deprecated: determined from paramtype");
getboolfield(L, nodedef_table, "sunlight_propagates", f.sunlight_propagates);
// This is used for collision detection.
// Also for general solidness queries.