From: Perttu Ahola Date: Sun, 9 Sep 2012 18:29:44 +0000 (+0300) Subject: Statically store always_collect field of __builtin:item X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=72ef6f637e7850a7714b08a9414fad3a64880b4c;p=zefram%2Fminetest%2Fminetest_engine.git Statically store always_collect field of __builtin:item --- diff --git a/builtin/item_entity.lua b/builtin/item_entity.lua index 2d763d50..2b12764f 100644 --- a/builtin/item_entity.lua +++ b/builtin/item_entity.lua @@ -57,11 +57,23 @@ minetest.register_entity("__builtin:item", { end, get_staticdata = function(self) - return self.itemstring + --return self.itemstring + return minetest.serialize({ + itemstring = self.itemstring, + always_collect = self.always_collect, + }) end, on_activate = function(self, staticdata) - self.itemstring = staticdata + if string.sub(staticdata, 1, string.len("return")) == "return" then + local data = minetest.deserialize(staticdata) + if data and type(data) == "table" then + self.itemstring = data.itemstring + self.always_collect = data.always_collect + end + else + self.itemstring = staticdata + end self.object:set_armor_groups({immortal=1}) self.object:setvelocity({x=0, y=2, z=0}) self.object:setacceleration({x=0, y=-10, z=0})