mirror of
https://github.com/minetest-mods/areas.git
synced 2024-12-25 10:10:41 +01:00
Add suport for multiple area save versions to /legacy_load_areas
This commit is contained in:
parent
ad04e7b5f6
commit
17b32663b7
10
legacy.lua
10
legacy.lua
@ -2,17 +2,23 @@
|
||||
-- the old areas format and other compatability code.
|
||||
|
||||
minetest.register_chatcommand("legacy_load_areas", {
|
||||
params = "",
|
||||
params = "<version>",
|
||||
description = "Loads, converts, and saves the areas from"
|
||||
.." a legacy node_ownership save file.",
|
||||
.." a legacy save file.",
|
||||
privs = {areas=true, server=true, privs=true},
|
||||
func = function(name, param)
|
||||
minetest.chat_send_player(name, "Converting areas...")
|
||||
local version = tonumber(param)
|
||||
if version == 0 then
|
||||
err = areas:node_ownership_load()
|
||||
if err then
|
||||
minetest.chat_send_player(name, "Error loading legacy file: "..err)
|
||||
return
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(name, "Invalid version number. (0 allowed)")
|
||||
return
|
||||
end
|
||||
minetest.chat_send_player(name, "Legacy file loaded.")
|
||||
|
||||
for k, area in pairs(areas.areas) do
|
||||
|
Loading…
Reference in New Issue
Block a user