Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- debug=require("component").debug.getWorld()
- serlib=require("serialization")
- ser=serlib.serialize
- unser=serlib.unserialize
- args={...}
- function scan(xstart, ystart, zstart, xstop, ystop, zstop)
- tableTMP={}
- for y=ystart, ystop do
- for x=xstart, xstop do
- for z=zstart, zstop do
- id=debug.getBlockId(x, y, z)
- if id~=0 then
- tmp={x-xstop, y-ystop, z-zstop, id, debug.getMetadata(x, y, z)}
- table.insert(tableTMP, tmp)
- print(x-xstop, y-ystop, z-zstop)
- end
- end
- end
- end
- return tableTMP
- end
- function saveFile()
- file=io.open(args[8], "w")
- file:write(ser(scan(args[2], args[3], args[4], args[5], args[6], args[7])))
- file:flush()
- file:close()
- end
- function place(filename, X, Y, Z)
- home=unser(io.lines(filename)())
- for i=1, #home do
- x, y, z, id, meta = home[i][1]+X, home[i][2]+Y, home[i][3]+Z, home[i][4], home[i][5]
- debug.setBlock(x, y, z, id, meta)
- print(x, y, z, id)
- end
- end
- if args[1]==nil then print("Использование: save <xstart> <ystart> <zstart> <xstop> <ystop> <zstop> <filename>\nplace <filename> <x> <y> <z>")
- elseif args[1]=="save" then saveFile()
- elseif args[1]=="place" then place(args[2], args[3], args[4], args[5])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement