mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Statically store always_collect field of __builtin:item
This commit is contained in:
parent
9cadaf824b
commit
72ef6f637e
@ -57,11 +57,23 @@ minetest.register_entity("__builtin:item", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
get_staticdata = function(self)
|
get_staticdata = function(self)
|
||||||
return self.itemstring
|
--return self.itemstring
|
||||||
|
return minetest.serialize({
|
||||||
|
itemstring = self.itemstring,
|
||||||
|
always_collect = self.always_collect,
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_activate = function(self, staticdata)
|
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:set_armor_groups({immortal=1})
|
||||||
self.object:setvelocity({x=0, y=2, z=0})
|
self.object:setvelocity({x=0, y=2, z=0})
|
||||||
self.object:setacceleration({x=0, y=-10, z=0})
|
self.object:setacceleration({x=0, y=-10, z=0})
|
||||||
|
Loading…
Reference in New Issue
Block a user