Misc mod data
Made for auto converter.
This commit is contained in:
parent
d75c6a24ad
commit
48e70baa50
|
@ -253,7 +253,7 @@ factions.register_command("list", {
|
|||
factions.register_command("version", {
|
||||
description = "Displays mod version.",
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
minetest.chat_send_player(player, "factions: version " .. factions_version , false)
|
||||
minetest.chat_send_player(player, "factions: version " .. misc_mod_data.data.factions_version , false)
|
||||
end
|
||||
},false)
|
||||
|
||||
|
|
|
@ -838,8 +838,10 @@ function factions.load()
|
|||
|
||||
if file ~= nil then
|
||||
local raw_data = file:read("*a")
|
||||
local current_version = misc_mod_data.data.factions_version
|
||||
misc_mod_data.load()
|
||||
factions.factions = minetest.deserialize(raw_data)
|
||||
if factions.is_old_file(factions.factions) then
|
||||
if current_version ~= misc_mod_data.data.factions_version or factions.is_old_file(factions.factions) then
|
||||
if factions.convert(filename) then
|
||||
minetest.after(5,
|
||||
function()
|
||||
|
@ -885,6 +887,7 @@ function factions.load()
|
|||
faction.onlineplayers = {}
|
||||
end
|
||||
file:close()
|
||||
misc_mod_data.save()
|
||||
end
|
||||
factions_ip.load()
|
||||
end
|
||||
|
|
8
init.lua
8
init.lua
|
@ -1,11 +1,8 @@
|
|||
factions_version = "0.8.1"
|
||||
|
||||
core.log("action", "MOD: factions (by sapier) loading ...")
|
||||
|
||||
--!path of mod
|
||||
factions_modpath = minetest.get_modpath("factions")
|
||||
|
||||
dofile (factions_modpath .. "/config.lua")
|
||||
dofile (factions_modpath .. "/misc_mod_data.lua")
|
||||
dofile (factions_modpath .. "/hud.lua")
|
||||
dofile (factions_modpath .. "/ip.lua")
|
||||
dofile (factions_modpath .. "/factions.lua")
|
||||
|
@ -13,5 +10,4 @@ dofile (factions_modpath .. "/chatcommands.lua")
|
|||
dofile (factions_modpath .. "/nodes.lua")
|
||||
|
||||
factions.load()
|
||||
|
||||
core.log("action","MOD: factions (by sapier) " .. factions_version .. " loaded.")
|
||||
misc_mod_data.check_file()
|
1
ip.lua
1
ip.lua
|
@ -23,7 +23,6 @@ function factions_ip.load()
|
|||
factions_ip.player_ips = minetest.deserialize(raw_data)
|
||||
file:close()
|
||||
else
|
||||
minetest.log("error","MOD factions: unable to load faction player ips!: " .. error)
|
||||
factions_ip.save()
|
||||
end
|
||||
end
|
38
misc_mod_data.lua
Normal file
38
misc_mod_data.lua
Normal file
|
@ -0,0 +1,38 @@
|
|||
misc_mod_data = {}
|
||||
misc_mod_data.data = {factions_version = "0.8.1"}
|
||||
|
||||
--read some basic information
|
||||
local factions_worldid = minetest.get_worldpath()
|
||||
|
||||
function misc_mod_data.save()
|
||||
local file,error = io.open(factions_worldid .. "/" .. "factions_misc_mod_data.txt","w")
|
||||
|
||||
if file ~= nil then
|
||||
file:write(minetest.serialize(misc_mod_data.data))
|
||||
file:close()
|
||||
else
|
||||
minetest.log("error","MOD factions: unable to save factions misc mod data!: " .. error)
|
||||
end
|
||||
end
|
||||
|
||||
function misc_mod_data.load()
|
||||
local file,error = io.open(factions_worldid .. "/" .. "factions_misc_mod_data.txt","r")
|
||||
|
||||
if file ~= nil then
|
||||
local raw_data = file:read("*a")
|
||||
misc_mod_data.data = minetest.deserialize(raw_data)
|
||||
file:close()
|
||||
else
|
||||
misc_mod_data.save()
|
||||
end
|
||||
end
|
||||
|
||||
function misc_mod_data.check_file()
|
||||
local file,error = io.open(factions_worldid .. "/" .. "factions_misc_mod_data.txt","r")
|
||||
|
||||
if file ~= nil then
|
||||
file:close()
|
||||
else
|
||||
misc_mod_data.save()
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user