pass path
This commit is contained in:
parent
834cdc04cd
commit
4739a3fdac
@ -1,11 +1,11 @@
|
||||
local global_env = ...
|
||||
|
||||
local function get_json_path(backend_def, chunk_pos)
|
||||
return backend_def.path .. "/chunk_" .. minetest.pos_to_string(chunk_pos) .. ".json"
|
||||
local function get_json_path(prefix, chunk_pos)
|
||||
return prefix .. "/chunk_" .. minetest.pos_to_string(chunk_pos) .. ".json"
|
||||
end
|
||||
|
||||
local function get_path(backend_def, chunk_pos)
|
||||
return backend_def.path .. "/chunk_" .. minetest.pos_to_string(chunk_pos) .. ".json"
|
||||
local function get_path(prefix, chunk_pos)
|
||||
return prefix .. "/chunk_" .. minetest.pos_to_string(chunk_pos) .. ".json"
|
||||
end
|
||||
|
||||
mapsync.register_backend_handler("patch", {
|
||||
@ -17,8 +17,8 @@ mapsync.register_backend_handler("patch", {
|
||||
assert(shadow_def.type == "fs")
|
||||
end,
|
||||
save_chunk = function(backend_def, chunk_pos)
|
||||
local baseline_chunk = mapsync.parse_chunk(get_path(backend_def, chunk_pos))
|
||||
local filename = get_json_path(backend_def, chunk_pos)
|
||||
local baseline_chunk = mapsync.parse_chunk(get_path(backend_def.path, chunk_pos))
|
||||
local filename = get_json_path(backend_def.path, chunk_pos)
|
||||
local f = global_env.io.open(filename, "w")
|
||||
|
||||
mapsync.create_diff(baseline_chunk, chunk_pos, function(changed_node)
|
||||
@ -30,9 +30,9 @@ mapsync.register_backend_handler("patch", {
|
||||
end,
|
||||
load_chunk = function(backend_def, chunk_pos, vmanip)
|
||||
-- TODO: apply diff if available
|
||||
return mapsync.deserialize_chunk(chunk_pos, get_path(backend_def, chunk_pos), vmanip)
|
||||
return mapsync.deserialize_chunk(chunk_pos, get_path(backend_def.path, chunk_pos), vmanip)
|
||||
end,
|
||||
get_manifest = function(backend_def, chunk_pos)
|
||||
mapsync.get_manifest(get_path(backend_def, chunk_pos))
|
||||
mapsync.get_manifest(get_path(backend_def.path, chunk_pos))
|
||||
end
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user