aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-09-09 21:29:44 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-09-09 23:14:41 +0300
commit72ef6f637e7850a7714b08a9414fad3a64880b4c (patch)
treed12e6b84464e045357a50fccaa1122dc74e50c3c /builtin
parent9cadaf824b3a59c85ad03f9c7185f43724b8e7ff (diff)
downloadminetest-72ef6f637e7850a7714b08a9414fad3a64880b4c.tar.gz
minetest-72ef6f637e7850a7714b08a9414fad3a64880b4c.tar.bz2
minetest-72ef6f637e7850a7714b08a9414fad3a64880b4c.zip
Statically store always_collect field of __builtin:item
Diffstat (limited to 'builtin')
-rw-r--r--builtin/item_entity.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/builtin/item_entity.lua b/builtin/item_entity.lua
index 2d763d50b..2b12764f1 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})