aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarr1024 <warr1024@gmail.com>2019-10-05 09:46:57 -0400
committersfan5 <sfan5@live.de>2019-10-05 15:46:57 +0200
commitad96df191b262aad311e28cba26d18316590bf28 (patch)
treeff348116a22185e66297a89a6f6c591b4f46dfcc
parent76032159bd4995c5d64a1f5cda7c63aab45e5cca (diff)
downloadminetest-ad96df191b262aad311e28cba26d18316590bf28.tar.gz
minetest-ad96df191b262aad311e28cba26d18316590bf28.tar.bz2
minetest-ad96df191b262aad311e28cba26d18316590bf28.zip
Merge pull request #8166 from Warr1024/fix7020
Fix (or workaround?) for 'Falling nodes with node inventory cause crash when unloaded'
-rw-r--r--builtin/game/falling.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua
index df213e304..950d6b56f 100644
--- a/builtin/game/falling.lua
+++ b/builtin/game/falling.lua
@@ -22,7 +22,18 @@ core.register_entity(":__builtin:falling_node", {
set_node = function(self, node, meta)
self.node = node
- self.meta = meta or {}
+ meta = meta or {}
+ if type(meta.to_table) == "function" then
+ meta = meta:to_table()
+ end
+ for _, list in pairs(meta.inventory or {}) do
+ for i, stack in pairs(list) do
+ if type(stack) == "userdata" then
+ list[i] = stack:to_string()
+ end
+ end
+ end
+ self.meta = meta
self.object:set_properties({
is_visible = true,
textures = {node.name},