mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 08:29:34 +01:00
Falling nodes: Workaround for inv crash (MT#7020)
This commit is contained in:
parent
d713cd193c
commit
0d4bb1a723
1 changed files with 14 additions and 1 deletions
|
@ -71,9 +71,20 @@ minetest.register_entity(":__builtin:falling_node", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
get_staticdata = function(self)
|
get_staticdata = function(self)
|
||||||
|
local meta = self.meta
|
||||||
|
-- Workaround: Save inventory seperately from metadata.
|
||||||
|
-- Because Minetest crashes when a node with inventory gets deactivated
|
||||||
|
-- (GitHub issue #7020).
|
||||||
|
-- FIXME: Remove the _inv workaround when it is no longer needed
|
||||||
|
local inv
|
||||||
|
if meta then
|
||||||
|
inv = meta.inv
|
||||||
|
meta.inventory = nil
|
||||||
|
end
|
||||||
local ds = {
|
local ds = {
|
||||||
node = self.node,
|
node = self.node,
|
||||||
meta = self.meta,
|
meta = self.meta,
|
||||||
|
_inv = inv,
|
||||||
_startpos = self._startpos,
|
_startpos = self._startpos,
|
||||||
_hit_players = self._hit_players,
|
_hit_players = self._hit_players,
|
||||||
}
|
}
|
||||||
|
@ -88,7 +99,9 @@ minetest.register_entity(":__builtin:falling_node", {
|
||||||
self._startpos = ds._startpos
|
self._startpos = ds._startpos
|
||||||
self._hit_players = ds._hit_players
|
self._hit_players = ds._hit_players
|
||||||
if ds.node then
|
if ds.node then
|
||||||
self:set_node(ds.node, ds.meta)
|
local meta = ds.meta
|
||||||
|
meta.inventory = ds._inv
|
||||||
|
self:set_node(ds.node, meta)
|
||||||
else
|
else
|
||||||
self:set_node(ds)
|
self:set_node(ds)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue