mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-26 02:30:40 +01:00
Quick and dirty fix for metasave not saving ItemStack instances in node metadata inventories.
This commit is contained in:
parent
fdca506505
commit
426dfb0bc3
@ -200,16 +200,24 @@ worldedit.metasave = function(pos1, pos2, file) --wip: simply work with strings
|
|||||||
local node = env:get_node(pos)
|
local node = env:get_node(pos)
|
||||||
if node.name ~= "air" and node.name ~= "ignore" then
|
if node.name ~= "air" and node.name ~= "ignore" then
|
||||||
count = count + 1
|
count = count + 1
|
||||||
local row = {
|
local meta = env:get_meta(pos):to_table()
|
||||||
|
|
||||||
|
--convert metadata itemstacks to itemstrings
|
||||||
|
for i, v in pairs(meta.inventory) do
|
||||||
|
for index, items in ipairs(v) do
|
||||||
|
v[index] = items:to_string()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(rows, {
|
||||||
x = pos.x-pos1.x,
|
x = pos.x-pos1.x,
|
||||||
y = pos.y-pos1.y,
|
y = pos.y-pos1.y,
|
||||||
z = pos.z-pos1.z,
|
z = pos.z-pos1.z,
|
||||||
name = node.name,
|
name = node.name,
|
||||||
param1 = node.param1,
|
param1 = node.param1,
|
||||||
param2 = node.param2,
|
param2 = node.param2,
|
||||||
meta = env:get_meta(pos):to_table(),
|
meta = meta,
|
||||||
}
|
})
|
||||||
table.insert(rows, row)
|
|
||||||
end
|
end
|
||||||
pos.z = pos.z + 1
|
pos.z = pos.z + 1
|
||||||
end
|
end
|
||||||
@ -217,8 +225,8 @@ worldedit.metasave = function(pos1, pos2, file) --wip: simply work with strings
|
|||||||
end
|
end
|
||||||
pos.x = pos.x + 1
|
pos.x = pos.x + 1
|
||||||
end
|
end
|
||||||
local err = table.save(rows,filename)
|
local err = table.save(rows, filename)
|
||||||
if err then return _,err end
|
if err then return _, err end
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user