2013-03-20 22:31:00 +01:00
|
|
|
worldedit = worldedit or {}
|
2013-07-12 20:22:30 +02:00
|
|
|
local minetest = minetest --local copy of global
|
2013-03-20 22:31:00 +01:00
|
|
|
|
2013-03-20 22:12:48 +01:00
|
|
|
worldedit.allocate_old = worldedit.allocate
|
2014-10-24 21:01:46 +02:00
|
|
|
|
2013-03-20 22:12:48 +01:00
|
|
|
worldedit.deserialize_old = worldedit.deserialize
|
2014-10-24 21:01:46 +02:00
|
|
|
|
2013-03-20 22:12:48 +01:00
|
|
|
worldedit.metasave = function(pos1, pos2, filename)
|
|
|
|
local file, err = io.open(filename, "wb")
|
|
|
|
if err then return 0 end
|
|
|
|
local data, count = worldedit.serialize(pos1, pos2)
|
|
|
|
file:write(data)
|
|
|
|
file:close()
|
|
|
|
return count
|
|
|
|
end
|
2014-10-24 21:01:46 +02:00
|
|
|
|
2013-03-20 22:12:48 +01:00
|
|
|
worldedit.metaload = function(originpos, filename)
|
|
|
|
filename = minetest.get_worldpath() .. "/schems/" .. file .. ".wem"
|
|
|
|
local file, err = io.open(filename, "wb")
|
|
|
|
if err then return 0 end
|
|
|
|
local data = file:read("*a")
|
|
|
|
return worldedit.deserialize(originpos, data)
|
2013-08-01 04:15:08 +02:00
|
|
|
end
|
2014-10-24 21:01:46 +02:00
|
|
|
|
2013-12-21 00:41:13 +01:00
|
|
|
worldedit.scale = function(pos1, pos2, factor)
|
|
|
|
return worldedit.stretch(pos1, pos2, factor, factor, factor)
|
2014-10-24 21:01:46 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
worldedit.valueversion = function(value)
|
|
|
|
local version = worldedit.read_header(value)
|
|
|
|
if not version or version > worldedit.LATEST_SERIALIZATION_VERSION then
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
return version
|
|
|
|
end
|
|
|
|
|