From ef8a756f8e01444069f8b75ccaeb05beb0a454d3 Mon Sep 17 00:00:00 2001 From: Aaron Suen Date: Sun, 3 Feb 2019 09:47:42 -0500 Subject: [PATCH] Workaround https://github.com/minetest/minetest/issues/7020 --- mods/nc_api/init.lua | 2 ++ mods/nc_api/issue7020.lua | 22 ++++++++++++++++++++++ mods/nc_fire/init.lua | 1 - mods/nc_lode/init.lua | 1 - mods/nc_tree/node.lua | 1 - 5 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 mods/nc_api/issue7020.lua diff --git a/mods/nc_api/init.lua b/mods/nc_api/init.lua index aa73dfeb..a30d42d4 100644 --- a/mods/nc_api/init.lua +++ b/mods/nc_api/init.lua @@ -11,6 +11,8 @@ rawset(_G, "nodecore", nodecore) local path = minetest.get_modpath(modname) +dofile(path .. "/issue7020.lua") + dofile(path .. "/util_misc.lua") dofile(path .. "/util_scan_flood.lua") dofile(path .. "/util_logtrace.lua") diff --git a/mods/nc_api/issue7020.lua b/mods/nc_api/issue7020.lua new file mode 100644 index 00000000..d8f21078 --- /dev/null +++ b/mods/nc_api/issue7020.lua @@ -0,0 +1,22 @@ +-- LUALOCALS < --------------------------------------------------------- +local minetest, pairs, setmetatable, type + = minetest, pairs, setmetatable, type +-- LUALOCALS > --------------------------------------------------------- + +local bifn = minetest.registered_entities["__builtin:falling_node"] +local falling = { + set_node = function(self, node, meta, ...) + meta = meta or {} + if type(meta) ~= "table" then meta = meta:to_table() end + for k1, v1 in pairs(meta.inventory or {}) do + for k2, v2 in pairs(v1) do + if type(v2) == "userdata" then + v1[k2] = v2:to_string() + end + end + end + return bifn.set_node(self, node, meta, ...) + end +} +setmetatable(falling, bifn) +minetest.register_entity(":__builtin:falling_node", falling) diff --git a/mods/nc_fire/init.lua b/mods/nc_fire/init.lua index d69df229..f8edff95 100644 --- a/mods/nc_fire/init.lua +++ b/mods/nc_fire/init.lua @@ -9,4 +9,3 @@ local path = minetest.get_modpath(modname) dofile(path .. "/api.lua") dofile(path .. "/node.lua") dofile(path .. "/abm.lua") - diff --git a/mods/nc_lode/init.lua b/mods/nc_lode/init.lua index 38856b82..7608f7fb 100644 --- a/mods/nc_lode/init.lua +++ b/mods/nc_lode/init.lua @@ -8,4 +8,3 @@ local path = minetest.get_modpath(modname) dofile(path .. "/ore.lua") dofile(path .. "/metallurgy.lua") - diff --git a/mods/nc_tree/node.lua b/mods/nc_tree/node.lua index b73b16fd..06c4d74b 100644 --- a/mods/nc_tree/node.lua +++ b/mods/nc_tree/node.lua @@ -62,4 +62,3 @@ nodecore.register_leaf_drops(function(pos, node, list) end) local function fixed(t) return {type = "fixed", fixed = t} end -