Skip to content

Commit ad96df1

Browse files
Warr1024sfan5
authored andcommittedOct 5, 2019
Merge pull request #8166 from Warr1024/fix7020
Fix (or workaround?) for 'Falling nodes with node inventory cause crash when unloaded'
1 parent 7603215 commit ad96df1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed
 

‎builtin/game/falling.lua

+12-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,18 @@ core.register_entity(":__builtin:falling_node", {
2222

2323
set_node = function(self, node, meta)
2424
self.node = node
25-
self.meta = meta or {}
25+
meta = meta or {}
26+
if type(meta.to_table) == "function" then
27+
meta = meta:to_table()
28+
end
29+
for _, list in pairs(meta.inventory or {}) do
30+
for i, stack in pairs(list) do
31+
if type(stack) == "userdata" then
32+
list[i] = stack:to_string()
33+
end
34+
end
35+
end
36+
self.meta = meta
2637
self.object:set_properties({
2738
is_visible = true,
2839
textures = {node.name},

0 commit comments

Comments
 (0)
Please sign in to comment.