diff options
author | orwell96 <mono96.mml@gmail.com> | 2017-09-28 17:11:51 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-09-28 17:11:51 +0200 |
commit | 08846cd05cd402cc7f8d025aaba96c5bb0aade2c (patch) | |
tree | 5c77ab4c23397bcb36bc9add361605296dcd3e0f /src/script | |
parent | 2afe62952c52e9dc9cbd413db9a316ae4359c331 (diff) | |
download | minetest-08846cd05cd402cc7f8d025aaba96c5bb0aade2c.tar.gz minetest-08846cd05cd402cc7f8d025aaba96c5bb0aade2c.tar.bz2 minetest-08846cd05cd402cc7f8d025aaba96c5bb0aade2c.zip |
Add static_save property to luaentites to not save them statically. (#5112)
* Add no_static_save property to luaentites to not save them statically.
This allows for temporary objects that would get deleted anyway as soon as they are loaded again without the static saving overhead.
* Use positive meaning for static_save object property
* Invert meaning also for the LUA parameter
Note: getboolfield() does not change &result when field does not exist, so it defaults to the default value in the header file, which is 'true'.
* Extend push_object_properties()
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/common/c_content.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 557430471..8f08de1e5 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -294,7 +294,10 @@ void read_object_properties(lua_State *L, int index, prop->automatic_face_movement_max_rotation_per_sec = luaL_checknumber(L, -1); } lua_pop(L, 1); + getstringfield(L, -1, "infotext", prop->infotext); + getboolfield(L, -1, "static_save", prop->static_save); + lua_getfield(L, -1, "wield_item"); if (!lua_isnil(L, -1)) prop->wield_item = read_item(L, -1, idef).getItemString(); @@ -376,6 +379,8 @@ void push_object_properties(lua_State *L, ObjectProperties *prop) lua_setfield(L, -2, "automatic_face_movement_max_rotation_per_sec"); lua_pushlstring(L, prop->infotext.c_str(), prop->infotext.size()); lua_setfield(L, -2, "infotext"); + lua_pushboolean(L, prop->static_save); + lua_setfield(L, -2, "static_save"); lua_pushlstring(L, prop->wield_item.c_str(), prop->wield_item.size()); lua_setfield(L, -2, "wield_item"); } |