diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-12-04 03:45:02 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-12-04 03:45:02 +0200 |
commit | 3e95b8a1587ebce9443d4d716645798bfbb630f2 (patch) | |
tree | b39df9c89aa2e9849ccffce96e92d6b7e456731d /src/scriptapi.cpp | |
parent | e8539d4dae46c926553ef0fa76afeaf6be6ecafb (diff) | |
download | minetest-3e95b8a1587ebce9443d4d716645798bfbb630f2.tar.gz minetest-3e95b8a1587ebce9443d4d716645798bfbb630f2.tar.bz2 minetest-3e95b8a1587ebce9443d4d716645798bfbb630f2.zip |
Determine light_propagates from paramtype
Diffstat (limited to 'src/scriptapi.cpp')
-rw-r--r-- | src/scriptapi.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index d7382b98b..ffbce9167 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -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. |