summaryrefslogtreecommitdiff
path: root/legacy.lua
diff options
context:
space:
mode:
authorShadowNinja <noreply@gmail.com>2013-09-17 12:46:00 -0400
committerShadowNinja <noreply@gmail.com>2013-09-17 12:46:00 -0400
commit17b32663b76428f84937ab79fab38259e6a1a831 (patch)
tree526eed607a9238852fbfe1fae7ff30e7666cd397 /legacy.lua
parentad04e7b5f692a8ff1910e35d3f4efcabaecebc60 (diff)
Add suport for multiple area save versions to /legacy_load_areas
Diffstat (limited to 'legacy.lua')
-rw-r--r--legacy.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/legacy.lua b/legacy.lua
index 4a86398..fcad766 100644
--- a/legacy.lua
+++ b/legacy.lua
@@ -2,15 +2,21 @@
-- 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...")
- err = areas:node_ownership_load()
- if err then
- minetest.chat_send_player(name, "Error loading legacy file: "..err)
+ 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.")